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.5 6.8 6.9
Change-Id: If84550ab82f8de51ff5af41c7f31838c4ed53a67
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2025-03-17 17:31:00 +01:00
parent 276ccda2f3
commit a67c13d1a6
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

@ -239,9 +239,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}"