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/RunCMake/NinjaMultiConfig | |
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/RunCMake/NinjaMultiConfig')
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/QtX-automoc-check-ninja-stdout.txt (renamed from Tests/RunCMake/NinjaMultiConfig/Qt5-automoc-check-ninja-stdout.txt) | 0 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/QtX-debug-in-release-graph-build-check.cmake (renamed from Tests/RunCMake/NinjaMultiConfig/Qt5-debug-in-release-graph-build-check.cmake) | 0 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/QtX.cmake (renamed from Tests/RunCMake/NinjaMultiConfig/Qt5.cmake) | 9 | ||||
-rw-r--r-- | Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake | 20 |
4 files changed, 19 insertions, 10 deletions
diff --git a/Tests/RunCMake/NinjaMultiConfig/Qt5-automoc-check-ninja-stdout.txt b/Tests/RunCMake/NinjaMultiConfig/QtX-automoc-check-ninja-stdout.txt index 85d5fdc..85d5fdc 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Qt5-automoc-check-ninja-stdout.txt +++ b/Tests/RunCMake/NinjaMultiConfig/QtX-automoc-check-ninja-stdout.txt diff --git a/Tests/RunCMake/NinjaMultiConfig/Qt5-debug-in-release-graph-build-check.cmake b/Tests/RunCMake/NinjaMultiConfig/QtX-debug-in-release-graph-build-check.cmake index 2d8df13..2d8df13 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Qt5-debug-in-release-graph-build-check.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/QtX-debug-in-release-graph-build-check.cmake diff --git a/Tests/RunCMake/NinjaMultiConfig/Qt5.cmake b/Tests/RunCMake/NinjaMultiConfig/QtX.cmake index 578256a..130f883 100644 --- a/Tests/RunCMake/NinjaMultiConfig/Qt5.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/QtX.cmake @@ -1,18 +1,21 @@ enable_language(CXX) -find_package(Qt5Core REQUIRED) +set(QtX Qt${with_qt_version}) + +find_package(${QtX} REQUIRED COMPONENTS Core) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC_COMPILER_PREDEFINES OFF) +# Source files are always named qt5.* for simplicity but apply to Qt5 and later add_executable(exe qt5.cxx) -target_link_libraries(exe PRIVATE Qt5::Core) +target_link_libraries(exe PRIVATE ${QtX}::Core) include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) generate_output_files(exe) set(moc_writes_depfiles 0) -if(Qt5Core_VERSION VERSION_GREATER_EQUAL "5.15.0") +if(${QtX}Core_VERSION VERSION_GREATER_EQUAL "5.15.0") set(moc_writes_depfiles 1) endif() diff --git a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake index 7c100eb..c7b876c 100644 --- a/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/NinjaMultiConfig/RunCMakeTest.cmake @@ -446,14 +446,20 @@ if(CMake_TEST_CUDA AND NOT CMake_TEST_CUDA STREQUAL "Clang") run_ninja(CudaSimple all-clean build-Debug.ninja clean:Debug) endif() -if(CMake_TEST_Qt5) - set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5-build) - set(RunCMake_TEST_OPTIONS "-DCMAKE_CROSS_CONFIGS=all" "-DQt5Core_DIR=${Qt5Core_DIR}") - run_cmake_configure(Qt5) +if(CMake_TEST_Qt_version) + set(QtX Qt${CMake_TEST_Qt_version}) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/QtX-build) + set(RunCMake_TEST_OPTIONS + "-DCMAKE_CROSS_CONFIGS=all" + "-Dwith_qt_version:STRING=${CMake_TEST_Qt_version}" + "-D${QtX}Core_DIR=${${QtX}Core_DIR}" + "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}" + ) + run_cmake_configure(QtX) unset(RunCMake_TEST_OPTIONS) include(${RunCMake_TEST_BINARY_DIR}/target_files.cmake) - run_cmake_build(Qt5 debug-in-release-graph Release exe:Debug) - if(CMAKE_TEST_Qt5Core_Version VERSION_GREATER_EQUAL 5.15.0) - run_ninja(Qt5 automoc-check build-Debug.ninja -t query exe_autogen/timestamp) + run_cmake_build(QtX debug-in-release-graph Release exe:Debug) + if(CMake_TEST_${QtX}Core_Version VERSION_GREATER_EQUAL 5.15.0) + run_ninja(QtX automoc-check build-Debug.ninja -t query exe_autogen/timestamp) endif() endif() |