summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-05-07 18:01:03 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2021-05-11 14:35:30 +0200
commit22a992cb12949bb15eec03f524ce97100c78bd0c (patch)
tree0a6f8e2ea05f1c5d095323f45f64c9e0b4f1217e /tests/auto
parentf37944623025f7e1466bbb1f6fbb142e718cfa51 (diff)
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>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/cmake/CMakeLists.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index 9311911a09..9e5195e723 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -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