The Qt6 package needs to be found before calling qt_build_internals_set_up_private_api, otherwise it will fail when using a cross-compiled Qt, because QT_HOST_PATH will not be set. The error is: CMake Error at qtbase/cmake/QtBuildHelpers.cmake:341 (message): You need to set QT_HOST_PATH to cross compile Qt. Call Stack (most recent call first): cmake/QtBuildHelpers.cmake:444 (qt_internal_check_host_path_set_for_cross_compiling) cmake/QtBuild.cmake:4 (qt_internal_setup_build_and_global_variables) cmake/QtSetup.cmake:6 (include) cmake/QtBuildRepoHelpers.cmake:21 (include) lib/cmake/Qt6BuildInternals/QtStandaloneTestTemplateProject/Main.cmake:7 (qt_build_internals_set_up_private_api) cmake/QtBuildRepoHelpers.cmake:1036 (include) cmake/QtBuildRepoHelpers.cmake:1053 (qt_internal_setup_standalone_test_when_called_as_a_find_package_component) lib/cmake/Qt6BuildInternals/Qt6BuildInternalsConfig.cmake:68 (qt_internal_setup_build_internals) CMakeLists.txt:11 (find_package) Pick-to: 6.7 6.5 Fixes: QTBUG-127668 Change-Id: I2fb3df05ce7aed3949d428d98657fe61de723abd Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 4f9da08b058382cf170bf3a0e14fc73c8cf4fecd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
37 lines
1.5 KiB
CMake
37 lines
1.5 KiB
CMake
# Copyright (C) 2022 The Qt Company Ltd.
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Includes QtSetup and friends for private CMake API.
|
|
set(QT_INTERNAL_IS_STANDALONE_TEST TRUE)
|
|
|
|
# Checks minimum CMake version and upgrades policies.
|
|
qt_internal_project_setup()
|
|
|
|
# Look for the Qt6 package before trying to call qt_build_internals_set_up_private_api,
|
|
# otherwise it will fail when using a cross-compiled Qt, because QT_HOST_PATH will not be set.
|
|
# QT_HOST_PATH is set by Qt6Dependencies.cmake.
|
|
find_package(Qt6 REQUIRED)
|
|
|
|
# Includes QtSetup.cmake.
|
|
qt_build_internals_set_up_private_api()
|
|
|
|
# Find all StandaloneTestsConfig.cmake files, and include them
|
|
# This will find all Qt packages that are required for standalone tests.
|
|
# It will find more packages that needed for a certain test, but will ensure any test can
|
|
# be built.
|
|
qt_get_standalone_parts_config_files_path(standalone_parts_config_path)
|
|
|
|
file(GLOB config_files "${standalone_parts_config_path}/*")
|
|
foreach(file ${config_files})
|
|
include("${file}")
|
|
endforeach()
|
|
|
|
# Set language standards after finding Core, because that's when the relevant
|
|
# feature variables are available.
|
|
qt_set_language_standards()
|
|
|
|
# Just before adding the test, change the local (non-cache) install prefix to something other than
|
|
# the Qt install prefix, so that tests don't try to install and pollute the Qt install prefix.
|
|
# Needs to be called after qt_get_standalone_parts_config_files_path().
|
|
qt_internal_set_up_fake_standalone_parts_install_prefix()
|