版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/csuzhaoqinghui/article/details/80675736
1、通过命令行的方式
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake -DCMAKE_BUILD_TYPE=Release ..
2、set(CMAKE_BUILD_TYPE Debug CACHE STRING “set build type to debug”)
set(CMAKE_BUILD_TYPE Release CACHE STRING “set build type to release”)
或者
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_BUILD_TYPE "Release")