summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/Autogen
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2021-10-04 11:10:56 (GMT)
committerCraig Scott <craig.scott@crascit.com>2021-10-04 11:10:57 (GMT)
commita7420884723c4fb09e6370fb25710a2172c10a0c (patch)
tree7d1d5cd434ca27e8b038457c784bf08af7f36c2f /Tests/RunCMake/Autogen
parentb3a0bddc4e1c8f1f86078cdffaebbc4c493e4409 (diff)
downloadCMake-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/RunCMake/Autogen')
-rw-r--r--Tests/RunCMake/Autogen/CMP0111-imported-target-prelude.cmake2
-rw-r--r--Tests/RunCMake/Autogen/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/Autogen/QtInFunction.cmake6
-rw-r--r--Tests/RunCMake/Autogen/QtInFunctionNested.cmake6
-rw-r--r--Tests/RunCMake/Autogen/QtInFunctionProperty.cmake6
-rw-r--r--Tests/RunCMake/Autogen/RunCMakeTest.cmake8
6 files changed, 18 insertions, 12 deletions
diff --git a/Tests/RunCMake/Autogen/CMP0111-imported-target-prelude.cmake b/Tests/RunCMake/Autogen/CMP0111-imported-target-prelude.cmake
index 8fa6041..6d26f99 100644
--- a/Tests/RunCMake/Autogen/CMP0111-imported-target-prelude.cmake
+++ b/Tests/RunCMake/Autogen/CMP0111-imported-target-prelude.cmake
@@ -1,6 +1,6 @@
enable_language(CXX)
-find_package(Qt5 REQUIRED COMPONENTS Core)
+find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core)
# Detect `-NOTFOUND` libraries at generate time.
cmake_policy(SET CMP0111 NEW)
diff --git a/Tests/RunCMake/Autogen/CMakeLists.txt b/Tests/RunCMake/Autogen/CMakeLists.txt
index 9a66cde..2632ffa 100644
--- a/Tests/RunCMake/Autogen/CMakeLists.txt
+++ b/Tests/RunCMake/Autogen/CMakeLists.txt
@@ -1,3 +1,3 @@
-cmake_minimum_required(VERSION 3.13)
+cmake_minimum_required(VERSION 3.16)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/Autogen/QtInFunction.cmake b/Tests/RunCMake/Autogen/QtInFunction.cmake
index a44bc5a..6c42cc2 100644
--- a/Tests/RunCMake/Autogen/QtInFunction.cmake
+++ b/Tests/RunCMake/Autogen/QtInFunction.cmake
@@ -1,9 +1,9 @@
enable_language(CXX)
function (use_autogen target)
- find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
- set(Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}" PARENT_SCOPE)
- set(Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}" PARENT_SCOPE)
+ find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets)
+ set(Qt${with_qt_version}Core_VERSION_MAJOR "${Qt${with_qt_version}Core_VERSION_MAJOR}" PARENT_SCOPE)
+ set(Qt${with_qt_version}Core_VERSION_MINOR "${Qt${with_qt_version}Core_VERSION_MINOR}" PARENT_SCOPE)
set_property(TARGET "${target}" PROPERTY AUTOMOC 1)
set_property(TARGET "${target}" PROPERTY AUTORCC 1)
set_property(TARGET "${target}" PROPERTY AUTOUIC 1)
diff --git a/Tests/RunCMake/Autogen/QtInFunctionNested.cmake b/Tests/RunCMake/Autogen/QtInFunctionNested.cmake
index 5421ba0..2e7b8ad 100644
--- a/Tests/RunCMake/Autogen/QtInFunctionNested.cmake
+++ b/Tests/RunCMake/Autogen/QtInFunctionNested.cmake
@@ -1,9 +1,9 @@
enable_language(CXX)
function (use_autogen target)
- find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
- set(Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}" PARENT_SCOPE)
- set(Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}" PARENT_SCOPE)
+ find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets)
+ set(Qt${with_qt_version}Core_VERSION_MAJOR "${Qt${with_qt_version}Core_VERSION_MAJOR}" PARENT_SCOPE)
+ set(Qt${with_qt_version}Core_VERSION_MINOR "${Qt${with_qt_version}Core_VERSION_MINOR}" PARENT_SCOPE)
set_property(TARGET "${target}" PROPERTY AUTOMOC 1)
set_property(TARGET "${target}" PROPERTY AUTORCC 1)
set_property(TARGET "${target}" PROPERTY AUTOUIC 1)
diff --git a/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake b/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake
index 35f1cd1..d9296c4 100644
--- a/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake
+++ b/Tests/RunCMake/Autogen/QtInFunctionProperty.cmake
@@ -1,13 +1,13 @@
enable_language(CXX)
function (use_autogen target)
- find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
+ find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets)
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
PROPERTY
- Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}")
+ Qt${with_qt_version}Core_VERSION_MAJOR "${Qt${with_qt_version}Core_VERSION_MAJOR}")
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
PROPERTY
- Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}")
+ Qt${with_qt_version}Core_VERSION_MINOR "${Qt${with_qt_version}Core_VERSION_MINOR}")
set_property(TARGET "${target}" PROPERTY AUTOMOC 1)
set_property(TARGET "${target}" PROPERTY AUTORCC 1)
set_property(TARGET "${target}" PROPERTY AUTOUIC 1)
diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake
index bbcbd5e..e4c5811 100644
--- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake
@@ -1,7 +1,13 @@
include(RunCMake)
run_cmake(NoQt)
-if (with_qt5)
+if (DEFINED with_qt_version)
+ set(RunCMake_TEST_OPTIONS
+ -Dwith_qt_version=${with_qt_version}
+ "-DQt${with_qt_version}_DIR:PATH=${Qt${with_qt_version}_DIR}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
+ )
+
run_cmake(QtInFunction)
run_cmake(QtInFunctionNested)
run_cmake(QtInFunctionProperty)