diff options
author | Robert Adam <dev@robert-adam.de> | 2020-09-01 12:01:51 +0300 |
---|---|---|
committer | Robert Adam <dev@robert-adam.de> | 2020-09-01 12:05:00 +0300 |
commit | 385341937c9a75a1b4ec726501cf0e4944939fd7 (patch) | |
tree | fb9ef703d20dbe96a5984cc47eb89e6e3f42c6bb | |
parent | 918f8c0d62b18cd1d3dbaa3ba721825fbe38c95d (diff) |
BUILD(cmake): Use GENERATOR_IS_MULTI_CONFIG
Instead of checking for the variable CMAKE_CONFIGURATION_TYPES, we now
use the dedicated property GENERATOR_IS_MULTI_CONFIG in order to
determine whether the used generator is a multi-config generator and
therefore does not respect the CMAKE_BUILD_TYPE variable.
-rw-r--r-- | CMakeLists.txt | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ab958752..7bd5220c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,13 +55,12 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Release" ) -# CMAKE_CONFIGURATION_TYPES exists with multi configuration generators, such as Visual Studio. -if(CMAKE_CONFIGURATION_TYPES) +get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTI_CONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE) -endif() -# We set the CMake configuration to "Release", in case it's not set. -if(NOT CMAKE_CONFIGURATION_TYPES) +else() + # We set the CMake configuration to "Release", in case it's not set. if(NOT CMAKE_BUILD_TYPE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY VALUE "Release") elseif(${CMAKE_BUILD_TYPE} STREQUAL "Debug") |