summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/QtAutoDetect.cmake6
-rw-r--r--cmake/QtBaseGlobalTargets.cmake5
-rw-r--r--cmake/QtFeature.cmake21
-rw-r--r--cmake/platforms/Platform/Integrity.cmake8
-rw-r--r--cmake/qt.toolchain.cmake.in6
5 files changed, 45 insertions, 1 deletions
diff --git a/cmake/QtAutoDetect.cmake b/cmake/QtAutoDetect.cmake
index 128a882b8d..ce87560a85 100644
--- a/cmake/QtAutoDetect.cmake
+++ b/cmake/QtAutoDetect.cmake
@@ -433,6 +433,12 @@ function(qt_auto_detect_integrity)
endif()
endfunction()
+# Let CMake load our custom platform modules.
+# CMake-provided platform modules take precedence.
+if(NOT QT_AVOID_CUSTOM_PLATFORM_MODULES)
+ list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/platforms")
+endif()
+
qt_auto_detect_cmake_generator()
qt_auto_detect_cyclic_toolchain()
qt_auto_detect_cmake_config()
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake
index dd7ceecb35..0c7d73375e 100644
--- a/cmake/QtBaseGlobalTargets.cmake
+++ b/cmake/QtBaseGlobalTargets.cmake
@@ -265,6 +265,11 @@ qt_copy_or_install(FILES
DESTINATION "${__GlobalConfig_install_dir}"
)
+# Install our custom platform modules.
+qt_copy_or_install(DIRECTORY cmake/platforms
+ DESTINATION "${__GlobalConfig_install_dir}"
+)
+
# Install public config.tests files.
qt_copy_or_install(DIRECTORY
"config.tests/static_link_order"
diff --git a/cmake/QtFeature.cmake b/cmake/QtFeature.cmake
index f7435df9de..3a366f05ae 100644
--- a/cmake/QtFeature.cmake
+++ b/cmake/QtFeature.cmake
@@ -801,7 +801,14 @@ function(qt_config_compile_test name)
# If the repo has its own cmake modules, include those in the module path, so that various
# find_package calls work.
if(EXISTS "${PROJECT_SOURCE_DIR}/cmake")
- list(APPEND flags "-DCMAKE_MODULE_PATH:STRING=${PROJECT_SOURCE_DIR}/cmake")
+ set(flags_copy "${flags}")
+ set(flags)
+ foreach(flag IN LISTS flags_copy)
+ if(flag MATCHES "^-DCMAKE_MODULE_PATH:STRING=")
+ set(flag "${flag};${PROJECT_SOURCE_DIR}/cmake")
+ endif()
+ list(APPEND flags "${flag}")
+ endforeach()
endif()
# Pass which packages need to be found.
@@ -907,6 +914,7 @@ function(qt_config_compile_test name)
set(_save_CMAKE_C_STANDARD "${CMAKE_C_STANDARD}")
set(_save_CMAKE_CXX_STANDARD "${CMAKE_CXX_STANDARD}")
set(_save_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+ set(_save_CMAKE_TRY_COMPILE_PLATFORM_VARIABLES "${CMAKE_TRY_COMPILE_PLATFORM_VARIABLES}")
if(arg_C_STANDARD)
set(CMAKE_C_STANDARD "${arg_C_STANDARD}")
@@ -928,6 +936,11 @@ function(qt_config_compile_test name)
list(APPEND CMAKE_REQUIRED_FLAGS "-Zc:__cplusplus")
endif()
+ # Let CMake load our custom platform modules.
+ if(NOT QT_AVOID_CUSTOM_PLATFORM_MODULES)
+ list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_MODULE_PATH)
+ endif()
+
set(_save_CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")
set(CMAKE_REQUIRED_LIBRARIES "${arg_LIBRARIES}")
check_cxx_source_compiles("${arg_UNPARSED_ARGUMENTS} ${arg_CODE}" HAVE_${name})
@@ -936,6 +949,7 @@ function(qt_config_compile_test name)
set(CMAKE_C_STANDARD "${_save_CMAKE_C_STANDARD}")
set(CMAKE_CXX_STANDARD "${_save_CMAKE_CXX_STANDARD}")
set(CMAKE_REQUIRED_FLAGS "${_save_CMAKE_REQUIRED_FLAGS}")
+ set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES "${_save_CMAKE_TRY_COMPILE_PLATFORM_VARIABLES}")
endif()
endif()
@@ -980,6 +994,11 @@ function(qt_get_platform_try_compile_vars out_var)
endif()
endforeach()
+ # Let CMake load our custom platform modules.
+ if(NOT QT_AVOID_CUSTOM_PLATFORM_MODULES)
+ list(APPEND flags_cmd_line "-DCMAKE_MODULE_PATH:STRING=${QT_CMAKE_DIR}/platforms")
+ endif()
+
# Pass darwin specific options.
# The architectures need to be passed explicitly to project-based try_compile calls even on
# macOS, so that arm64 compilation works on Apple silicon.
diff --git a/cmake/platforms/Platform/Integrity.cmake b/cmake/platforms/Platform/Integrity.cmake
new file mode 100644
index 0000000000..964a01fc2f
--- /dev/null
+++ b/cmake/platforms/Platform/Integrity.cmake
@@ -0,0 +1,8 @@
+# Custom platform module file for INTEGRITY.
+#
+# UNIX must be set here, because this variable is cleared after the toolchain file is loaded.
+#
+# Once the lowest CMake version we support ships an Integrity platform module,
+# we can remove this file.
+
+set(UNIX 1)
diff --git a/cmake/qt.toolchain.cmake.in b/cmake/qt.toolchain.cmake.in
index 38a7431620..79a37fd95a 100644
--- a/cmake/qt.toolchain.cmake.in
+++ b/cmake/qt.toolchain.cmake.in
@@ -70,6 +70,12 @@ get_filename_component(QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR "${CMAKE_CURRENT_LIST_
list(PREPEND CMAKE_PREFIX_PATH "${QT_TOOLCHAIN_RELOCATABLE_CMAKE_DIR}")
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_TOOLCHAIN_RELOCATABLE_INSTALL_PREFIX}")
+# Let CMake load our custom platform modules.
+# CMake-provided platform modules take precedence.
+if(NOT QT_AVOID_CUSTOM_PLATFORM_MODULES)
+ list(PREPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/platforms")
+endif()
+
# Handle packages located in QT_ADDITIONAL_PACKAGES_PREFIX_PATH when cross-compiling. Needed for
# Conan.
# We prepend to CMAKE_PREFIX_PATH so that a find_package(Qt6Foo) call works, without having to go