From 01aff4a1c30a9aa12f64af56d65c80f192eaa41e Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 17 Mar 2025 17:54:32 +0100 Subject: [PATCH] Avoid using the PROJECT_VERSION when accessing the HostInfo package variables The related functionality meant to be enabled by BuildInternals, which makes the lookup of the pre-defined HostInfo version based on either calculated or pre-defined INSTALL_CMAKE_NAMESPACE. The PROJECT_VESION(_MAJOR) meanwhile is hardcoded by the current Qt repo, which is not necessary aligned with BuildInternals/HostInfo. Pick-to: 6.8 6.5 Change-Id: I61052c93ce2d6ee3c6d8025da2e078edcde48d0d Reviewed-by: Alexandru Croitor (cherry picked from commit 56ec6b4843ff1e3763ad9cb608acfb21ea4db341) Reviewed-by: Qt Cherry-pick Bot --- cmake/QtConfig.cmake.in | 2 +- cmake/QtPostProcessHelpers.cmake | 2 +- cmake/QtToolHelpers.cmake | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/QtConfig.cmake.in b/cmake/QtConfig.cmake.in index 1b96dd57d09..dea906769bd 100644 --- a/cmake/QtConfig.cmake.in +++ b/cmake/QtConfig.cmake.in @@ -150,7 +150,7 @@ foreach(module ${__qt_umbrella_find_components}) # But don't match QtShaderTools and QtTools which are cross-compiled target package names. # Allow opt out just in case. get_filename_component(__qt_find_package_host_qt_path - "${Qt@PROJECT_VERSION_MAJOR@HostInfo_DIR}/.." ABSOLUTE) + "${@INSTALL_CMAKE_NAMESPACE@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}" diff --git a/cmake/QtPostProcessHelpers.cmake b/cmake/QtPostProcessHelpers.cmake index d57f68f09a4..180c207c7a2 100644 --- a/cmake/QtPostProcessHelpers.cmake +++ b/cmake/QtPostProcessHelpers.cmake @@ -432,7 +432,7 @@ endif()") # to the target CMAKE_INSTALL_DIR, if at all possible to do so in a reliable way. get_filename_component(qt_host_path_absolute "${QT_HOST_PATH}" ABSOLUTE) get_filename_component(qt_host_path_cmake_dir_absolute - "${Qt${PROJECT_VERSION_MAJOR}HostInfo_DIR}/.." ABSOLUTE) + "${${INSTALL_CMAKE_NAMESPACE}HostInfo_DIR}/.." ABSOLUTE) endif() if(third_party_deps OR platform_requires_host_info_package) diff --git a/cmake/QtToolHelpers.cmake b/cmake/QtToolHelpers.cmake index 22e083b1208..a7e1842c04f 100644 --- a/cmake/QtToolHelpers.cmake +++ b/cmake/QtToolHelpers.cmake @@ -712,14 +712,14 @@ function(qt_internal_find_tool out_var target_name tools_target) set(${tools_package_name}_BACKUP_CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH}") if(QT_HOST_PATH_CMAKE_DIR) set(qt_host_path_cmake_dir_absolute "${QT_HOST_PATH_CMAKE_DIR}") - elseif(Qt${PROJECT_VERSION_MAJOR}HostInfo_DIR) + elseif(${INSTALL_CMAKE_NAMESPACE}HostInfo_DIR) get_filename_component(qt_host_path_cmake_dir_absolute - "${Qt${PROJECT_VERSION_MAJOR}HostInfo_DIR}/.." ABSOLUTE) + "${${INSTALL_CMAKE_NAMESPACE}HostInfo_DIR}/.." ABSOLUTE) else() # This should never happen, serves as an assert. message(FATAL_ERROR "Neither QT_HOST_PATH_CMAKE_DIR nor " - "Qt${PROJECT_VERSION_MAJOR}HostInfo_DIR available.") + "${INSTALL_CMAKE_NAMESPACE}HostInfo_DIR available.") endif() set(CMAKE_PREFIX_PATH "${qt_host_path_cmake_dir_absolute}")