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/QtAutogen/MacOsFW | |
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/QtAutogen/MacOsFW')
-rw-r--r-- | Tests/QtAutogen/MacOsFW/CMakeLists.txt | 22 | ||||
-rw-r--r-- | Tests/QtAutogen/MacOsFW/src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Tests/QtAutogen/MacOsFW/test/CMakeLists.txt | 12 |
3 files changed, 20 insertions, 20 deletions
diff --git a/Tests/QtAutogen/MacOsFW/CMakeLists.txt b/Tests/QtAutogen/MacOsFW/CMakeLists.txt index c08efc4..27c5f43 100644 --- a/Tests/QtAutogen/MacOsFW/CMakeLists.txt +++ b/Tests/QtAutogen/MacOsFW/CMakeLists.txt @@ -1,21 +1,23 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.16) project(MacOsFW) include("../AutogenGuiTest.cmake") -find_package(Qt5Test REQUIRED) +find_package(Qt${QT_TEST_VERSION}Test REQUIRED) + +if(QT_TEST_VERSION EQUAL 5) + set(CMAKE_CXX_STANDARD 11) +elseif(QT_TEST_VERSION EQUAL 6) + set(CMAKE_CXX_STANDARD 17) +else() + message(FATAL_ERROR "Unsupported Qt version: ${QT_TEST_VERSION}") +endif() -set(CMAKE_CXX_STANDARD 11) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/lib) set(CMAKE_INSTALL_NAME_DIR ${CMAKE_BINARY_DIR}/output/lib) -if(POLICY CMP0042) # in CMake 3.0.0+ - set (CMAKE_MACOSX_RPATH OFF) # otherwise ON by default -endif(POLICY CMP0042) - -if(POLICY CMP0068) # in CMake 3.9+ - cmake_policy(SET CMP0068 NEW) -endif(POLICY CMP0068) +set (CMAKE_MACOSX_RPATH OFF) # otherwise ON by default +cmake_policy(SET CMP0068 NEW) add_subdirectory(src) add_subdirectory(test) diff --git a/Tests/QtAutogen/MacOsFW/src/CMakeLists.txt b/Tests/QtAutogen/MacOsFW/src/CMakeLists.txt index a02be00..67e2c8a 100644 --- a/Tests/QtAutogen/MacOsFW/src/CMakeLists.txt +++ b/Tests/QtAutogen/MacOsFW/src/CMakeLists.txt @@ -9,7 +9,7 @@ set(MACOS_FW_LIB_HDRS include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} - ${Qt5Core_INCLUDE_DIRS} + ${Qt${QT_TEST_VERSION}Core_INCLUDE_DIRS} ) add_library(macos_fw_lib SHARED @@ -28,6 +28,4 @@ set_target_properties(macos_fw_lib PROPERTIES POSITION_INDEPENDENT_CODE ON PUBLIC_HEADER "${MACOS_FW_LIB_HDRS}" ) -target_link_libraries(macos_fw_lib - Qt5::Core -) +target_link_libraries(macos_fw_lib PRIVATE ${QT_QTCORE_TARGET}) diff --git a/Tests/QtAutogen/MacOsFW/test/CMakeLists.txt b/Tests/QtAutogen/MacOsFW/test/CMakeLists.txt index 521c184..8cb1bc5 100644 --- a/Tests/QtAutogen/MacOsFW/test/CMakeLists.txt +++ b/Tests/QtAutogen/MacOsFW/test/CMakeLists.txt @@ -4,16 +4,16 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../src ) include_directories(SYSTEM - ${Qt5Core_INCLUDE_DIRS} - ${Qt5Widgets_INCLUDE_DIRS} + ${Qt${QT_TEST_VERSION}Core_INCLUDE_DIRS} + ${Qt${QT_TEST_VERSION}Widgets_INCLUDE_DIRS} ) set(testname AutomocMacosFWLib) add_executable(${testname} testMacosFWLib.cpp) set_target_properties(${testname} PROPERTIES AUTOMOC TRUE) -target_link_libraries(${testname} - Qt5::Core - Qt5::Widgets - Qt5::Test +target_link_libraries(${testname} PRIVATE + Qt${QT_TEST_VERSION}::Core + Qt${QT_TEST_VERSION}::Widgets + Qt${QT_TEST_VERSION}::Test macos_fw_lib ) |