Consider cross compilation when detecting host tools requirements

If Qt is crosscompiled it's not necessary that it always require host
tools to compile the application. That's why the pre-stored assumpion
in Qt6Dependencies.cmake is incorrect. When moving the Qt toolchain
to the target platform, this Qt becomes the native toolchain for this
platform, so the requirement is incorrect since this moment.

The detection should consider the CMAKE_CROSSCOMPILING flag and put
the host tools requirement only in this case. Also if user predefined
QT_HOST_TOOLS it also makes sense to require them and look for the
Qt6HostInfo package.

Pick-to: 6.10
Change-Id: I4c715eb2592ce79565787645aac172ff60b91493
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2025-08-12 18:49:53 +02:00
parent 5992945869
commit 4f44f43332
1 changed files with 3 additions and 1 deletions

View File

@ -7,8 +7,10 @@ if(DEFINED QT_REQUIRE_HOST_PATH_CHECK)
set(__qt_platform_requires_host_info_package "${QT_REQUIRE_HOST_PATH_CHECK}")
elseif(DEFINED ENV{QT_REQUIRE_HOST_PATH_CHECK})
set(__qt_platform_requires_host_info_package "$ENV{QT_REQUIRE_HOST_PATH_CHECK}")
else()
elseif(CMAKE_CROSSCOMPILING OR DEFINED QT_HOST_PATH)
set(__qt_platform_requires_host_info_package "@platform_requires_host_info_package@")
else()
set(__qt_platform_requires_host_info_package FALSE)
endif()
set(__qt_platform_initial_qt_host_path "@qt_host_path_absolute@")
set(__qt_platform_initial_qt_host_path_cmake_dir "@qt_host_path_cmake_dir_absolute@")