CMake: Skip building CMake build tests in a prefix in-tree config

The Qt CMake packages are not installed yet, so the CMake build
projects can't find Qt and fail to configure.

Skip the CMake build tests in a prefix in-tree configuration and issue
a warning for informational purposes.

Change-Id: Ie5cb5b9f6f1d8ec258b70528680e31c711c20f85
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2021-05-07 18:01:03 +02:00
parent f379446230
commit 22a992cb12

View File

@ -44,6 +44,22 @@ cmake_minimum_required(VERSION 3.14)
project(cmake_usage_tests)
# Building the CMake tests as part of a Qt prefix build + in-tree tests, currently doesn't work.
# Each CMake test will fail with a message like
#
# CMake Error at qtbase/lib/cmake/Qt6/Qt6Config.cmake:33 (include):
# include could not find load file:
# qtbase/lib/cmake/Qt6/Qt6Targets.cmake
#
# That's because the Qt packages are not installed, and we try to load the Config files from the
# build dir, but they can't work in a prefix build without installation.
# Configuring the tests as standalone tests or as a separate project works fine.
# Configuring the tests in-tree also works fine in a non-prefix build.
if(QT_REPO_MODULE_VERSION AND NOT QT_BUILD_STANDALONE_TESTS AND QT_WILL_INSTALL)
message(WARNING
"Skipping building CMake build tests because they don't work in a prefix in-tree config")
endif()
enable_testing()
# Most of the tests fail to build on Boot2qt / qemu with undefined references to QtDBus because