summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-07-13 11:05:52 +1000
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-16 20:13:52 +0000
commit0296e2df37baef8f042317e41cbf3dda74dcd700 (patch)
tree7d9a405d1e0f3f8aa04384be46b9544a38f10bbb
parentf8a586ae191a1c4b89004babe31b1076dd82c4e1 (diff)
CMake: Handle single- and multi-config differences more robustly
Projects sometimes set both CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE regardless of what CMake generator they are using. They shouldn't, but it is common enough that we should protect against it. The GENERATOR_IS_MULTI_CONFIG global property is the only robust way to know which type of generator we are using, so switch to that for how we detect this. Change-Id: If5d6568da0d2adb3275bbaf9a7d3bd3e033dc636 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit b30ac93a3737628da118f2137d96c7773ea9e239) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/corelib/Qt6CoreMacros.cmake13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index 370e703a4d..9d3e2a646b 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -970,16 +970,17 @@ function(qt6_extract_metatypes target)
AUTOMOC_MOC_OPTIONS "--output-json"
)
- if(NOT CMAKE_CONFIGURATION_TYPES)
+ get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+ if(NOT is_multi_config)
set(cmake_autogen_cache_file
"${target_binary_dir}/CMakeFiles/${target}_autogen.dir/ParseCache.txt")
- set(mutli_config_args
+ set(multi_config_args
--cmake-autogen-include-dir-path "${target_binary_dir}/${target}_autogen/include"
)
else()
set(cmake_autogen_cache_file
"${target_binary_dir}/CMakeFiles/${target}_autogen.dir/ParseCache_$<CONFIG>.txt")
- set(mutli_config_args
+ set(multi_config_args
--cmake-autogen-include-dir-path "${target_binary_dir}/${target}_autogen/include_$<CONFIG>"
"--cmake-multi-config")
endif()
@@ -1029,7 +1030,7 @@ function(qt6_extract_metatypes target)
--cmake-autogen-cache-file "${cmake_autogen_cache_file}"
--cmake-autogen-info-file "${cmake_autogen_info_file}"
--output-file-path "${type_list_file}"
- ${mutli_config_args}
+ ${multi_config_args}
COMMENT "Running AUTOMOC file extraction for target ${target}"
COMMAND_EXPAND_LISTS
)
@@ -1047,7 +1048,7 @@ function(qt6_extract_metatypes target)
--cmake-autogen-cache-file "${cmake_autogen_cache_file}"
--cmake-autogen-info-file "${cmake_autogen_info_file}"
--output-file-path "${type_list_file}"
- ${mutli_config_args}
+ ${multi_config_args}
COMMENT "Running AUTOMOC file extraction for target ${target}"
COMMAND_EXPAND_LISTS
)
@@ -1073,7 +1074,7 @@ function(qt6_extract_metatypes target)
message(FATAL_ERROR "Metatype generation requires either the use of AUTOMOC or a manual list of generated json files")
endif()
- if (CMAKE_BUILD_TYPE)
+ if (CMAKE_BUILD_TYPE AND NOT is_multi_config)
string(TOLOWER ${target}_${CMAKE_BUILD_TYPE} target_lowercase)
else()
string(TOLOWER ${target} target_lowercase)