summaryrefslogtreecommitdiffstats
path: root/tests/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-11-01 11:48:23 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-11-08 15:42:32 +0000
commitde3a806def4b9a754825a2233c9d4952a9b2d0eb (patch)
tree499fe14eff3b255f943ece94551eb58619a346c0 /tests/CMakeLists.txt
parentc1ba9bb72a3eeb0bd707e609da156798c51c17f0 (diff)
Make standalone tests build via top level repo project
Previously repo/tests/CMakeLists.txt was a standalone project on which CMake could be called. This was useful for Coin to be able to build and package only tests, but was a bit troublesome because that means having to specify the usual boilerplate like minimum CMake version, which packages to find in every tests.pro project. Instead of having a separate standalone project, modify the top level project and associated CMake code to allow passing a special QT_BUILD_STANDALONE_TESTS variable, which causes the top level project to build only tests, and find Qt in the previously installed qt location. This also means that when building a repo, we generate a ${repo_name}TestsConfig.cmake file which does find_package on all the modules that have been built as part of that repo. So that when standalone tests bare built for that repo, the modules are automatically found. qt_set_up_standalone_tests_build() is modified to be a no-op because it is not needed anymore. Its usage should be removed from all the other repos, and then removed from qtbase. Non-adjusted tests/CMakeLists.txt projects in other repositories should still be buildable with the current code, until they are updated to the new format. Adjust the Coin build instructions to build the standalone tests in a separate directory. Adjust pro2cmake to generate new structure for the tests/tests.pro projects. Adjust the qtbase tests project. Fixes: QTBUG-79239 Change-Id: Ib4b66bc772d8876cdcbae1e90ce5a5a5234fa675 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r--tests/CMakeLists.txt20
1 files changed, 6 insertions, 14 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index ae0aa141f4..d1a395c9f3 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,21 +1,13 @@
-# special case begin
-if(NOT TARGET Qt::Test)
- cmake_minimum_required(VERSION 3.14.0)
- project(QtBaseTests VERSION 6.0.0 LANGUAGES C CXX ASM)
- find_package(Qt6 REQUIRED COMPONENTS BuildInternals Core Test)
- find_package(Qt6 COMPONENTS DBus Gui OpenGL Widgets Xml
- AccessibilitySupport LinuxAccessibilitySupport
- WindowsUIAutomationSupport
- )
- qt_set_up_standalone_tests_build()
+# Generated from tests.pro.
- # Find a few packages that are usually found in configure.cmake,
- # because a few tests link directly against those libraries.
+if(QT_BUILD_STANDALONE_TESTS)
+ # Add qt_find_package calls for extra dependencies that need to be found when building
+ # the standalone tests here.
+ # special case begin
qt_find_package(WrapDBus1 PROVIDED_TARGETS dbus-1)
qt_find_package(ICU COMPONENTS i18n uc data PROVIDED_TARGETS ICU::i18n ICU::uc ICU::data)
qt_find_package(Threads PROVIDED_TARGETS Threads::Threads)
qt_find_package(OpenSSL PROVIDED_TARGETS OpenSSL::OpenSSL)
+ # special case end
endif()
-# special case end
-
qt_build_tests()