diff options
author | Craig Scott <craig.scott@crascit.com> | 2021-10-04 11:10:56 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2021-10-04 11:10:57 (GMT) |
commit | a7420884723c4fb09e6370fb25710a2172c10a0c (patch) | |
tree | 7d1d5cd434ca27e8b038457c784bf08af7f36c2f /Tests/CMakeLists.txt | |
parent | b3a0bddc4e1c8f1f86078cdffaebbc4c493e4409 (diff) | |
download | CMake-a7420884723c4fb09e6370fb25710a2172c10a0c.zip CMake-a7420884723c4fb09e6370fb25710a2172c10a0c.tar.gz CMake-a7420884723c4fb09e6370fb25710a2172c10a0c.tar.bz2 |
Tests: Add support for testing Qt6
The minimum CMake version for Qt6 is 3.16, so all the calls to
cmake_minimum_required() are updated here to enforce that
minimum. This will avoid any CMake version-related warnings
from Qt.
Avoid hard-coding Qt5 where the tests could now be using
Qt5 or Qt6.
Fixes: #22188
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r-- | Tests/CMakeLists.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index da6b670..20b6e25 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -257,6 +257,13 @@ if(BUILD_TESTING) #--------------------------------------------------------------------------- # Add tests below here. + if(NOT DEFINED CMake_TEST_Qt6) + set(CMake_TEST_Qt6 1) + endif() + if(CMake_TEST_Qt6) + find_package(Qt6 COMPONENTS Core Widgets QUIET NO_MODULE) + endif() + if(NOT DEFINED CMake_TEST_Qt5) set(CMake_TEST_Qt5 1) endif() @@ -1384,6 +1391,9 @@ if(BUILD_TESTING) ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/QtAutomocNoQt") + if(CMake_TEST_Qt6 AND Qt6Widgets_FOUND) + add_subdirectory(Qt6Autogen) + endif() if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND) add_subdirectory(Qt5Autogen) endif() |