本文翻译自:Debug vs Release in CMake
In a GCC compiled project, 在GCC编译的项目中,
- How do I run CMake for each target type (debug/release)? 如何为每种目标类型(调试/发布)运行CMake?
- How do I specify debug and release C/C++ flags using CMake? 如何使用CMake指定调试和发布C / C ++标志?
- How do I express that the main executable will be compiled with
g++
and one nested library withgcc
? 我如何表达将使用g++
编译主可执行文件以及使用gcc
编译一个嵌套库?
#1楼
参考:https://stackoom.com/question/WPVp/CMake中的调试与发布
#2楼
// CMakeLists.txt : release // CMakeLists.txt:发布
set(CMAKE_CONFIGURATION_TYPES "Release" CACHE STRING "" FORCE)
// CMakeLists.txt : debug // CMakeLists.txt:调试
set(CMAKE_CONFIGURATION_TYPES "Debug" CACHE STRING "" FORCE)
#3楼
Instead of manipulating the CMAKE_CXX_FLAGS
strings directly (whi