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.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>
(cherry picked from commit 2a0d34373e62f8b2fbe243438e20f2ac118b638c)
This commit is contained in:
Alexey Edelev 2024-02-29 08:10:31 +01:00 committed by Qt Cherry-pick Bot
parent 97a3fea42b
commit a6cb5512c6
2 changed files with 18 additions and 0 deletions

View File

@ -62,6 +62,8 @@ if(NOT DEFINED QT_CMAKE_EXPORT_NAMESPACE)
set(QT_CMAKE_EXPORT_NAMESPACE @QT_CMAKE_EXPORT_NAMESPACE@) set(QT_CMAKE_EXPORT_NAMESPACE @QT_CMAKE_EXPORT_NAMESPACE@)
endif() endif()
__qt_internal_collect_additional_module_paths()
# Propagate sanitizer flags to both internal Qt builds and user projects. # 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. # Allow opt-out in case if downstream projects handle it in a different way.
set(QT_CONFIGURED_SANITIZER_OPTIONS "@ECM_ENABLE_SANITIZERS@") set(QT_CONFIGURED_SANITIZER_OPTIONS "@ECM_ENABLE_SANITIZERS@")

View File

@ -81,6 +81,22 @@ function(__qt_internal_collect_additional_prefix_paths out_var prefixes_var)
set("${out_var}" "${additional_packages_prefix_paths}" PARENT_SCOPE) set("${out_var}" "${additional_packages_prefix_paths}" PARENT_SCOPE)
endfunction() 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 # Take a list of prefix paths ending with "/lib/cmake", and return a list of absolute paths with
# "/lib/cmake" removed. # "/lib/cmake" removed.
function(__qt_internal_prefix_paths_to_roots out_var prefix_paths) function(__qt_internal_prefix_paths_to_roots out_var prefix_paths)