cmake: Do not modify build types when integrating by downstream project
The `CMAKE_BUILD_TYPE` and `CMAKE_CONFIGURATION_TYPES` variables must be managed by the downstream project. Suggesting to review with `git diff -w`.
This commit is contained in:
@@ -213,23 +213,25 @@ mark_as_advanced(
|
|||||||
CMAKE_SHARED_LINKER_FLAGS_COVERAGE
|
CMAKE_SHARED_LINKER_FLAGS_COVERAGE
|
||||||
)
|
)
|
||||||
|
|
||||||
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
if(PROJECT_IS_TOP_LEVEL)
|
||||||
set(default_build_type "RelWithDebInfo")
|
get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
if(is_multi_config)
|
set(default_build_type "RelWithDebInfo")
|
||||||
set(CMAKE_CONFIGURATION_TYPES "${default_build_type}" "Release" "Debug" "MinSizeRel" "Coverage" CACHE STRING
|
if(is_multi_config)
|
||||||
"Supported configuration types."
|
set(CMAKE_CONFIGURATION_TYPES "${default_build_type}" "Release" "Debug" "MinSizeRel" "Coverage" CACHE STRING
|
||||||
FORCE
|
"Supported configuration types."
|
||||||
)
|
|
||||||
else()
|
|
||||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
|
|
||||||
STRINGS "${default_build_type}" "Release" "Debug" "MinSizeRel" "Coverage"
|
|
||||||
)
|
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
|
||||||
message(STATUS "Setting build type to \"${default_build_type}\" as none was specified")
|
|
||||||
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING
|
|
||||||
"Choose the type of build."
|
|
||||||
FORCE
|
FORCE
|
||||||
)
|
)
|
||||||
|
else()
|
||||||
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
|
||||||
|
STRINGS "${default_build_type}" "Release" "Debug" "MinSizeRel" "Coverage"
|
||||||
|
)
|
||||||
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
|
message(STATUS "Setting build type to \"${default_build_type}\" as none was specified")
|
||||||
|
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING
|
||||||
|
"Choose the type of build."
|
||||||
|
FORCE
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user