summaryrefslogtreecommitdiffstats
path: root/cmake/QtAutoDetect.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/QtAutoDetect.cmake')
-rw-r--r--cmake/QtAutoDetect.cmake18
1 files changed, 18 insertions, 0 deletions
diff --git a/cmake/QtAutoDetect.cmake b/cmake/QtAutoDetect.cmake
index 1823d1e572..95ace249ad 100644
--- a/cmake/QtAutoDetect.cmake
+++ b/cmake/QtAutoDetect.cmake
@@ -156,6 +156,24 @@ function(qt_auto_detect_ios)
endif()
endfunction()
+function(qt_auto_detect_cmake_config)
+ if(CMAKE_CONFIGURATION_TYPES)
+ # Allow users to specify this option.
+ if(NOT QT_MULTI_CONFIG_FIRST_CONFIG)
+ list(GET CMAKE_CONFIGURATION_TYPES 0 first_config_type)
+ set(QT_MULTI_CONFIG_FIRST_CONFIG "${first_config_type}")
+ set(QT_MULTI_CONFIG_FIRST_CONFIG "${first_config_type}" PARENT_SCOPE)
+ endif()
+
+ set(CMAKE_TRY_COMPILE_CONFIGURATION "${QT_MULTI_CONFIG_FIRST_CONFIG}" PARENT_SCOPE)
+ if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
+ set(CMAKE_NINJA_MULTI_CROSS_CONFIG_ENABLE ON PARENT_SCOPE)
+ set(CMAKE_NINJA_MULTI_DEFAULT_BUILD_TYPE "${QT_MULTI_CONFIG_FIRST_CONFIG}" PARENT_SCOPE)
+ endif()
+ endif()
+endfunction()
+
+qt_auto_detect_cmake_config()
qt_auto_detect_ios()
qt_auto_detect_android()
qt_auto_detect_vpckg()