summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2024-02-29 08:10:31 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-03-13 17:15:29 +0000
commit2a0d34373e62f8b2fbe243438e20f2ac118b638c (patch)
treeb05400344a9687f6819fb621e8011c60b8592fb8 /cmake
parentb79cd66130dc585c31a1722d7bd4c65826ffe329 (diff)
Collect CMAKE_MODULE_PATH from QT_ADDITIONAL_PACKAGES_PREFIX_PATH
This is sensitive for the 'include' calls that expect cmake scripts to be found in some staging prefixes. In yocto QT_ADDITIONAL_PACKAGES_PREFIX_PATH points to the package image path(installation snapshot). If repo provides bundled 3rdparties the 'include' statement that includes 'FindWrap<3rdparty>ConfigExtra' is unnable to locate it, since it's expected to be found in Qt installation, but the file didn't land there at ptest stage. Fixes: QTBUG-122205 Pick-to: 6.6 6.5 Change-Id: Idd03f44efd2e3fdaa476873068c73ac28cd0a7b5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 8db0a12e84075e0e41f6a92027df74fe2b2d2182) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtConfig.cmake.in2
-rw-r--r--cmake/QtPublicCMakeHelpers.cmake16
2 files changed, 18 insertions, 0 deletions
diff --git a/cmake/QtConfig.cmake.in b/cmake/QtConfig.cmake.in
index fb0e823eaa..28e8bac187 100644
--- a/cmake/QtConfig.cmake.in
+++ b/cmake/QtConfig.cmake.in
@@ -65,6 +65,8 @@ if(NOT DEFINED QT_CMAKE_EXPORT_NAMESPACE)
set(QT_CMAKE_EXPORT_NAMESPACE @QT_CMAKE_EXPORT_NAMESPACE@)
endif()
+__qt_internal_collect_additional_module_paths()
+
# Propagate sanitizer flags to both internal Qt builds and user projects.
# Allow opt-out in case if downstream projects handle it in a different way.
set(QT_CONFIGURED_SANITIZER_OPTIONS "@ECM_ENABLE_SANITIZERS@")
diff --git a/cmake/QtPublicCMakeHelpers.cmake b/cmake/QtPublicCMakeHelpers.cmake
index 4cf3d13391..de21f90814 100644
--- a/cmake/QtPublicCMakeHelpers.cmake
+++ b/cmake/QtPublicCMakeHelpers.cmake
@@ -81,6 +81,22 @@ function(__qt_internal_collect_additional_prefix_paths out_var prefixes_var)
set("${out_var}" "${additional_packages_prefix_paths}" PARENT_SCOPE)
endfunction()
+# Collects CMAKE_MODULE_PATH from QT_ADDITIONAL_PACKAGES_PREFIX_PATH
+function(__qt_internal_collect_additional_module_paths)
+ if(__qt_additional_module_paths_set)
+ return()
+ endif()
+ foreach(prefix_path IN LISTS QT_ADDITIONAL_PACKAGES_PREFIX_PATH)
+ list(APPEND CMAKE_MODULE_PATH "${prefix_path}/${QT_CMAKE_EXPORT_NAMESPACE}")
+ # TODO: Need to consider the INSTALL_LIBDIR value when collecting CMAKE_MODULE_PATH.
+ # See QTBUG-123039.
+ list(APPEND CMAKE_MODULE_PATH "${prefix_path}/lib/cmake/${QT_CMAKE_EXPORT_NAMESPACE}")
+ endforeach()
+ list(REMOVE_DUPLICATES CMAKE_MODULE_PATH)
+ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" PARENT_SCOPE)
+ set(__qt_additional_module_paths_set TRUE PARENT_SCOPE)
+endfunction()
+
# Take a list of prefix paths ending with "/lib/cmake", and return a list of absolute paths with
# "/lib/cmake" removed.
function(__qt_internal_prefix_paths_to_roots out_var prefix_paths)