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.

Pick-to: 6.6
Change-Id: I4bdb33e56818984c189b737acccc9ac50659db96
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2023-08-07 11:12:35 +02:00
parent e3925996f1
commit d09a9f6de3

View File

@ -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)