CMake: Use Qt6HostInfo dir for Tools CMAKE_PREFIX_PATH assignment

Instead of hard-coding a lib/cmake suffix to CMAKE_PREFIX_PATH
use the parent directory of the Qt6HostInfo package which is always
searched for when QT_HOST_PATH is set.

Amends d2359b2d4e5db6c42158d536d6e2a2af5ea1e59c

Pick-to: 6.2
Change-Id: I7f3c8fe17bc82f733580d68d928146434a57d849
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2021-10-20 17:52:00 +02:00
parent 102c1cff72
commit 402b8b9cee

View File

@ -142,7 +142,8 @@ foreach(module ${@INSTALL_CMAKE_NAMESPACE@_FIND_COMPONENTS})
# Allow opt out just in case.
# TODO: Handle a hypothetical QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH
# See QTBUG-94524
set(__qt_find_package_host_qt_path "${QT_HOST_PATH}/lib/cmake")
get_filename_component(__qt_find_package_host_qt_path
"${Qt@PROJECT_VERSION_MAJOR@HostInfo_DIR}/.." ABSOLUTE)
set(__qt_backup_cmake_prefix_path "${CMAKE_PREFIX_PATH}")
set(__qt_backup_cmake_find_root_path "${CMAKE_FIND_ROOT_PATH}")
list(PREPEND CMAKE_PREFIX_PATH "${__qt_find_package_host_qt_path}")