From 3627d0ed2d8ee4229d2e2635c1631eb145d3a27b Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 17 Mar 2025 17:31:00 +0100 Subject: [PATCH] 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 (cherry picked from commit a67c13d1a68db40d1c2e9f89bcc76aa244feb8d0) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtBuildHelpers.cmake | 4 ++-- cmake/QtConfigDependencies.cmake.in | 3 ++- cmake/QtPublicDependencyHelpers.cmake | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cmake/QtBuildHelpers.cmake b/cmake/QtBuildHelpers.cmake index 3f9f4c9e5a1..662b6be581c 100644 --- a/cmake/QtBuildHelpers.cmake +++ b/cmake/QtBuildHelpers.cmake @@ -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() - diff --git a/cmake/QtConfigDependencies.cmake.in b/cmake/QtConfigDependencies.cmake.in index eb08ec41fb7..e68e2954f9d 100644 --- a/cmake/QtConfigDependencies.cmake.in +++ b/cmake/QtConfigDependencies.cmake.in @@ -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@") diff --git a/cmake/QtPublicDependencyHelpers.cmake b/cmake/QtPublicDependencyHelpers.cmake index 8e00afe4280..ec342a7eac7 100644 --- a/cmake/QtPublicDependencyHelpers.cmake +++ b/cmake/QtPublicDependencyHelpers.cmake @@ -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}"