默认情况下,CMake生成的VS项目具有以下构建配置:
我不需要MinSizeRelease配置,我想要的只是Debug和ReleaseWithDebInfo。 所以,在阅读FAQ(http://www.cmake.org/Wiki/CMake_FAQ)之后,我尝试了
message("value of CMAKE_CONFIGURATION_TYPES before: ${CMAKE_CONFIGURATION_TYPES}")
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES Debug RelWithDebInfo)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Reset the configurations to what we need" FORCE)
endif()
message("value of CMAKE_CONFIGURATION_TYPES after: ${CMAKE_CONFIGURATION_TYPES}")
project("sys_utils_tests")
输出是:
value of CMAKE_CONFIGURATION_TYPES before: Debug;Release;MinSizeRel;RelWithDebInfo
value of CMAKE_CONFIGURATION_TYPES after: Debug;RelWithDebInfo
但是,当我打开生成的项目时,我仍然会看到Debug; Release; MinSizeRel; RelWithDebInfo配置。有什么问题?