Merge bitcoin-core/secp256k1#1543: cmake: Do not modify build types when integrating by downstream project
158f9e5eaecmake: Do not modify build types when integrating by downstream project (Hennadii Stepanov) Pull request description: The `CMAKE_BUILD_TYPE` and `CMAKE_CONFIGURATION_TYPES` must be managed by the downstream project. Suggesting to review with `git diff -w`. Fixes `std::out_of_range` exception from CMake in https://github.com/hebasto/bitcoin/pull/192 when running configuration step using "Ninja Multi-Config" generator: ``` $ cmake -B build -G "Ninja Multi-Config" ... -- Configuring done (17.1s) terminate called after throwing an instance of 'std::out_of_range' what(): map::at Aborted (core dumped) ``` Here are related discussions: - https://discourse.cmake.org/t/uncaught-exception-when-trying-to-generate-a-project-using-ninja-multi-config/11051 - https://gitlab.kitware.com/cmake/cmake/-/issues/26064 ACKs for top commit: real-or-random: ACK158f9e5eaeTree-SHA512: b3040f40438d530f14b7e0f7d523e74b5843d88d250ff7955a99cc8c451feb9471a48134d1a89b3651b3f8195f91c17135c7b8a5d3ab092c8d35275b57743b8c
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