From 22a992cb12949bb15eec03f524ce97100c78bd0c Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 7 May 2021 18:01:03 +0200 Subject: 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 Reviewed-by: Joerg Bornemann --- tests/auto/cmake/CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests') 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 -- cgit v1.2.3