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/AutogenCoreTest.cmake | |
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/AutogenCoreTest.cmake')
-rw-r--r-- | Tests/QtAutogen/AutogenCoreTest.cmake | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Tests/QtAutogen/AutogenCoreTest.cmake b/Tests/QtAutogen/AutogenCoreTest.cmake index 5803859..e62a6aa 100644 --- a/Tests/QtAutogen/AutogenCoreTest.cmake +++ b/Tests/QtAutogen/AutogenCoreTest.cmake @@ -21,27 +21,27 @@ if (QT_TEST_VERSION EQUAL 4) qt4_generate_moc(${ARGN}) endmacro() -elseif(QT_TEST_VERSION EQUAL 5) +elseif(QT_TEST_VERSION GREATER_EQUAL 5) - find_package(Qt5Core REQUIRED) + find_package(Qt${QT_TEST_VERSION}Core REQUIRED) - set(QT_QTCORE_TARGET Qt5::Core) - set(QT_LIBRARIES Qt5::Core) + set(QT_QTCORE_TARGET Qt${QT_TEST_VERSION}::Core) + set(QT_LIBRARIES Qt${QT_TEST_VERSION}::Core) # Include directories - include_directories(${Qt5Core_INCLUDE_DIRS}) + include_directories(${Qt${QT_TEST_VERSION}Core_INCLUDE_DIRS}) # Definitions - if(Qt5_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) + if(Qt${QT_TEST_VERSION}_POSITION_INDEPENDENT_CODE AND CMAKE_CXX_COMPILE_OPTIONS_PIC) add_definitions(${CMAKE_CXX_COMPILE_OPTIONS_PIC}) endif() # Qt macros macro(qtx_wrap_cpp) - qt5_wrap_cpp(${ARGN}) + cmake_language(CALL qt${QT_TEST_VERSION}_wrap_cpp ${ARGN}) endmacro() macro(qtx_generate_moc) - qt5_generate_moc(${ARGN}) + cmake_language(CALL qt${QT_TEST_VERSION}_generate_moc ${ARGN}) endmacro() else() |