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.5 6.8 6.9
Change-Id: I61052c93ce2d6ee3c6d8025da2e078edcde48d0d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2025-03-17 17:54:32 +01:00
parent a67c13d1a6
commit 56ec6b4843
3 changed files with 5 additions and 5 deletions

View File

@ -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}"

View File

@ -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)

View File

@ -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}")