Make the HostInfo package lookup properly versioned

Avoid hardcoding the HostInfo package version, use the
INSTALL_CMAKE_NAMESPACE as the reference for the find_package calls.

If we assume that the package follows the versioning in the future,
we should consider the Qt version, to avoid any version related
issues.

Pick-to: 6.8 6.5
Change-Id: If84550ab82f8de51ff5af41c7f31838c4ed53a67
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit a67c13d1a68db40d1c2e9f89bcc76aa244feb8d0)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexey Edelev 2025-03-17 17:31:00 +01:00 committed by Qt Cherry-pick Bot
parent b758518896
commit 3627d0ed2d
3 changed files with 6 additions and 5 deletions

View File

@ -361,7 +361,8 @@ endfunction()
macro(qt_internal_setup_find_host_info_package)
_qt_internal_determine_if_host_info_package_needed(__qt_build_requires_host_info_package)
_qt_internal_find_host_info_package("${__qt_build_requires_host_info_package}")
_qt_internal_find_host_info_package("${__qt_build_requires_host_info_package}"
${INSTALL_CMAKE_NAMESPACE})
endmacro()
macro(qt_internal_setup_poor_mans_scope_finalizer)
@ -489,4 +490,3 @@ macro(qt_internal_setup_build_and_global_variables)
qt_internal_detect_dirty_features()
endmacro()

View File

@ -17,7 +17,8 @@ _qt_internal_setup_qt_host_path(
"${__qt_platform_requires_host_info_package}"
"${__qt_platform_initial_qt_host_path}"
"${__qt_platform_initial_qt_host_path_cmake_dir}")
_qt_internal_find_host_info_package(${__qt_platform_requires_host_info_package})
_qt_internal_find_host_info_package(${__qt_platform_requires_host_info_package}
@INSTALL_CMAKE_NAMESPACE@)
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
set(__qt_third_party_deps "@third_party_deps@")

View File

@ -229,9 +229,9 @@ function(_qt_internal_determine_if_host_info_package_needed out_var)
set(${out_var} "${needed}" PARENT_SCOPE)
endfunction()
macro(_qt_internal_find_host_info_package platform_requires_host_info)
macro(_qt_internal_find_host_info_package platform_requires_host_info install_namespace)
if(${platform_requires_host_info})
find_package(Qt6HostInfo
find_package(${install_namespace}HostInfo
CONFIG
REQUIRED
PATHS "${QT_HOST_PATH}"