CMAKE 3.3.2: Set build type in CMakeLists.txt
问题 Is there a way to set the build type from CMakeLists.txt? So that with (or without) generating a new makefile when I compile it should go with the release mode. I try something along the lines of: set(DCMAKE_BUILD_TYPE "Release") But it doesn't work (compiles in debug mode). This is on a linux system. Thanks. 回答1: It's simply: set(CMAKE_BUILD_TYPE "Release") 来源: https://stackoverflow.com/questions/34558795/cmake-3-3-2-set-build-type-in-cmakelists-txt