From fa7a19e97a289d0dca3f7b8b7c4d1caafe9e4a07 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 7 Aug 2023 11:12:35 +0200 Subject: [PATCH] Use Release and Debug configuration for multi-config Qt builds by default If user attempt to build Qt using multi-config generator set Release and Debug configurations by default if they are not set, instead of relying on what CMake suggests as default value for a platform. Change-Id: I4bdb33e56818984c189b737acccc9ac50659db96 Reviewed-by: Alexandru Croitor (cherry picked from commit d09a9f6de3cf672e52fd4081eec7b07b9ed0e877) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtAutoDetect.cmake | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/QtAutoDetect.cmake b/cmake/QtAutoDetect.cmake index cbbda362b55..0e2ede24eff 100644 --- a/cmake/QtAutoDetect.cmake +++ b/cmake/QtAutoDetect.cmake @@ -244,7 +244,15 @@ function(qt_auto_detect_ios) endfunction() function(qt_auto_detect_cmake_config) - if(CMAKE_CONFIGURATION_TYPES) + # If CMAKE_CONFIGURATION_TYPES are not set for the multi-config generator use Release and + # Debug configurations by default, instead of those are proposed by the CMake internal logic. + get_property(is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(is_multi) + if(NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_CONFIGURATION_TYPES Release Debug) + set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" PARENT_SCOPE) + endif() + # Allow users to specify this option. if(NOT QT_MULTI_CONFIG_FIRST_CONFIG) list(GET CMAKE_CONFIGURATION_TYPES 0 first_config_type)