CMake 编写默认编译、链接选项小技巧

选项大全很好的博客:

https://blog.csdn.net/icbm/article/details/52336497

写法小记录:

这个写法亮度是后面的${CMAKE_SHARED_LINKER_FLAGS_RELEASE}可以保留原本的配置

set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMTD.lib ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/NODEFAULTLIB:LIBCMT.lib ${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")

//cmake release版本生产pdb

set(CMAKE_CXX_FLAGS_RELEASE "/MD /Zi /Od /Ob2 /DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "/MD /Zi /Od /Ob2 /DNDEBUG")

set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/DEBUG")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "/DEBUG ${CMAKE_MODULE_LINKER_FLAGS_RELEASE}")

 

 

你可能感兴趣的:(Cmake)