CMake: Improve Qt6HostInfo package lookup condition
Instead of checking if QT_HOST_PATH is set during user project configuration to find out if Qt6HostInfo should be looked up, record if QT_HOST_PATH was provided during Qt configuration into Qt6Dependencies.cmake and look up the package in a user project based on that information. This improves handling of the case where cmake is directly used to configure a Qt project (instead of qt-cmake), which means no QT_HOST_PATH might be set by the user, and then cmake would error out saying that e.g. Qt6CoreTools is not found, instead of saying that Qt6HostInfo is not found. Pick-to: 6.4 Task-number: QTBUG-104998 Change-Id: I0377d5440e4b5b295af73cfd4b5188f61d48e440 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
a41bef8ede
commit
7b24ffa936
@ -558,7 +558,8 @@ if(CMAKE_CROSSCOMPILING)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
_qt_internal_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}")
|
||||
|
||||
# TODO: This block provides support for old variables. It should be removed once
|
||||
# we remove all references to these variables in other Qt module repos.
|
||||
|
@ -1,6 +1,7 @@
|
||||
set(@INSTALL_CMAKE_NAMESPACE@_FOUND FALSE)
|
||||
|
||||
_qt_internal_find_host_info_package()
|
||||
set(__qt_platform_requires_host_info_package "@platform_requires_host_info_package@")
|
||||
_qt_internal_find_host_info_package(${__qt_platform_requires_host_info_package})
|
||||
|
||||
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
|
||||
set(__qt_third_party_deps "@third_party_deps@")
|
||||
|
@ -369,7 +369,9 @@ function(qt_internal_create_qt6_dependencies_file)
|
||||
endif()")
|
||||
endif()
|
||||
|
||||
if(third_party_deps)
|
||||
_qt_internal_determine_if_host_info_package_needed(platform_requires_host_info_package)
|
||||
|
||||
if(third_party_deps OR platform_requires_host_info_package)
|
||||
# Setup build and install paths.
|
||||
set(path_suffix "${INSTALL_CMAKE_NAMESPACE}")
|
||||
|
||||
|
@ -192,8 +192,16 @@ macro(_qt_internal_save_find_package_context_for_debugging infix)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(_qt_internal_find_host_info_package)
|
||||
function(_qt_internal_determine_if_host_info_package_needed out_var)
|
||||
set(needed FALSE)
|
||||
if(NOT "${QT_HOST_PATH}" STREQUAL "")
|
||||
set(needed TRUE)
|
||||
endif()
|
||||
set(${out_var} "${needed}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
macro(_qt_internal_find_host_info_package platform_requires_host_info)
|
||||
if(${platform_requires_host_info})
|
||||
find_package(Qt6HostInfo
|
||||
CONFIG
|
||||
REQUIRED
|
||||
|
Loading…
Reference in New Issue
Block a user