From 385341937c9a75a1b4ec726501cf0e4944939fd7 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Tue, 1 Sep 2020 11:01:51 +0200 Subject: 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. --- CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'CMakeLists.txt') 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") -- cgit v1.2.3