summaryrefslogtreecommitdiffstats
path: root/Tests
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
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')
-rw-r--r--Tests/CMakeLists.txt10
-rw-r--r--Tests/Qt6Autogen/CMakeLists.txt8
-rw-r--r--Tests/QtAutogen/AutogenCoreTest.cmake16
-rw-r--r--Tests/QtAutogen/AutogenGuiTest.cmake16
-rw-r--r--Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/Complex/CMakeLists.txt4
-rw-r--r--Tests/QtAutogen/Complex/codeeditor.cpp4
-rw-r--r--Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt3
-rw-r--r--Tests/QtAutogen/GlobalAutogenTarget/GAT/CMakeLists.txt4
-rw-r--r--Tests/QtAutogen/MacOsFW/CMakeLists.txt22
-rw-r--r--Tests/QtAutogen/MacOsFW/src/CMakeLists.txt6
-rw-r--r--Tests/QtAutogen/MacOsFW/test/CMakeLists.txt12
-rw-r--r--Tests/QtAutogen/ManySources/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/MocCMP0071/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/MocCMP0071/NEW/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/MocCMP0071/OLD/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/MocCMP0100/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/MocCMP0100/NEW/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/MocCMP0100/OLD/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/MocInclude/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt3
-rw-r--r--Tests/QtAutogen/MocMacroName/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/MocOnly/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/MocOptions/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/MocOsMacros/CMakeLists.txt6
-rw-r--r--Tests/QtAutogen/MocSkipSource/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/ObjectLibrary/CMakeLists.txt4
-rw-r--r--Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/Parallel/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/Parallel1/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/Parallel2/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/Parallel3/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/Parallel4/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/ParallelAUTO/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/RccEmpty/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt8
-rw-r--r--Tests/QtAutogen/RccOnly/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/RccSkipSource/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/RerunMocBasic/CMakeLists.txt3
-rw-r--r--Tests/QtAutogen/RerunMocBasic/MocBasic/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt3
-rw-r--r--Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in2
-rw-r--r--Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt9
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt3
-rw-r--r--Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt4
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt3
-rw-r--r--Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/RerunRccDepends/CMakeLists.txt3
-rw-r--r--Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt1
-rw-r--r--Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in2
-rw-r--r--Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/TestMacros.cmake11
-rw-r--r--Tests/QtAutogen/UicInclude/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/UicInterface/CMakeLists.txt6
-rw-r--r--Tests/QtAutogen/UicNoGui/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/UicOnly/CMakeLists.txt2
-rw-r--r--Tests/QtAutogen/UicSkipSource/CMakeLists.txt2
-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
-rw-r--r--Tests/RunCMake/CMakeLists.txt64
-rw-r--r--Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake21
-rw-r--r--Tests/RunCMake/Ninja/QtAutoMocDeps.cmake27
-rw-r--r--Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/Ninja/RunCMakeTest.cmake21
-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.cmake20
77 files changed, 271 insertions, 165 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()
diff --git a/Tests/Qt6Autogen/CMakeLists.txt b/Tests/Qt6Autogen/CMakeLists.txt
new file mode 100644
index 0000000..a603b50
--- /dev/null
+++ b/Tests/Qt6Autogen/CMakeLists.txt
@@ -0,0 +1,8 @@
+# Set Qt test version and include the Autogen test macros
+set(QT_TEST_VERSION 6)
+include("../QtAutogen/TestMacros.cmake")
+
+# Common tests
+include("../QtAutogen/Tests.cmake")
+
+set(TEST_BUILD_DIRS "${TEST_BUILD_DIRS}" PARENT_SCOPE)
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()
diff --git a/Tests/QtAutogen/AutogenGuiTest.cmake b/Tests/QtAutogen/AutogenGuiTest.cmake
index b76d341..e5eb751 100644
--- a/Tests/QtAutogen/AutogenGuiTest.cmake
+++ b/Tests/QtAutogen/AutogenGuiTest.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(Qt5Widgets REQUIRED)
+ find_package(Qt${QT_TEST_VERSION}Widgets REQUIRED)
- set(QT_QTCORE_TARGET Qt5::Core)
- set(QT_LIBRARIES Qt5::Widgets)
+ set(QT_QTCORE_TARGET Qt${QT_TEST_VERSION}::Core)
+ set(QT_LIBRARIES Qt${QT_TEST_VERSION}::Widgets)
# Include directories
- include_directories(${Qt5Widgets_INCLUDE_DIRS})
+ include_directories(${Qt${QT_TEST_VERSION}Widgets_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()
diff --git a/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt b/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt
index 17855ff..cac680f 100644
--- a/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt
+++ b/Tests/QtAutogen/AutogenOriginDependsOff/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.11)
+cmake_minimum_required(VERSION 3.16)
project(AutogenOriginDependsOff)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt b/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt
index 5aabe0e..37ce90b 100644
--- a/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt
+++ b/Tests/QtAutogen/AutogenOriginDependsOn/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(AutogenOriginDependsOn)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt b/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt
index 492b5db..cf3f155 100644
--- a/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt
+++ b/Tests/QtAutogen/AutogenTargetDepends/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(AutogenTargetDepends)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/Complex/CMakeLists.txt b/Tests/QtAutogen/Complex/CMakeLists.txt
index d9fdf5c..8a9a5d2 100644
--- a/Tests/QtAutogen/Complex/CMakeLists.txt
+++ b/Tests/QtAutogen/Complex/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(Complex)
include("../AutogenGuiTest.cmake")
@@ -16,6 +16,8 @@ add_library(privateSlot OBJECT private_slot.cpp)
# Pass Qt compiler features to targets that don't link against Qt
target_compile_features(codeeditorLib PRIVATE ${QT_COMPILE_FEATURES})
target_compile_features(privateSlot PRIVATE ${QT_COMPILE_FEATURES})
+target_link_libraries(codeeditorLib PRIVATE ${QT_LIBRARIES})
+target_link_libraries(privateSlot PRIVATE ${QT_LIBRARIES})
configure_file(generated_resource.qrc.in generated_resource.qrc @ONLY)
add_custom_command(
diff --git a/Tests/QtAutogen/Complex/codeeditor.cpp b/Tests/QtAutogen/Complex/codeeditor.cpp
index 80d6a55..9c9dbc3 100644
--- a/Tests/QtAutogen/Complex/codeeditor.cpp
+++ b/Tests/QtAutogen/Complex/codeeditor.cpp
@@ -70,7 +70,11 @@ int CodeEditor::lineNumberAreaWidth()
++digits;
}
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
+ int space = 3 + fontMetrics().horizontalAdvance(QLatin1Char('9')) * digits;
+#else
int space = 3 + fontMetrics().width(QLatin1Char('9')) * digits;
+#endif
return space;
}
diff --git a/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt b/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt
index e95c626..5c70e43 100644
--- a/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt
+++ b/Tests/QtAutogen/GlobalAutogenTarget/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.16)
project(GlobalAutogenTarget)
include("../AutogenCoreTest.cmake")
@@ -74,6 +74,7 @@ execute_process(
-T "${CMAKE_GENERATOR_TOOLSET}"
"-DQT_TEST_VERSION=${QT_TEST_VERSION}"
"-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
WORKING_DIRECTORY "${GAT_BDIR}"
OUTPUT_VARIABLE output
diff --git a/Tests/QtAutogen/GlobalAutogenTarget/GAT/CMakeLists.txt b/Tests/QtAutogen/GlobalAutogenTarget/GAT/CMakeLists.txt
index 3925197..0e3df6f 100644
--- a/Tests/QtAutogen/GlobalAutogenTarget/GAT/CMakeLists.txt
+++ b/Tests/QtAutogen/GlobalAutogenTarget/GAT/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.16)
project(GAT)
include("../../AutogenCoreTest.cmake")
@@ -9,7 +9,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
-# Disable ORIGN_DEPENDS and enable AUTOGEN global targets
+# Disable ORIGIN_DEPENDS and enable AUTOGEN global targets
set(CMAKE_AUTOGEN_ORIGIN_DEPENDS OFF)
set(CMAKE_GLOBAL_AUTOGEN_TARGET ON)
set(CMAKE_GLOBAL_AUTORCC_TARGET ON)
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
)
diff --git a/Tests/QtAutogen/ManySources/CMakeLists.txt b/Tests/QtAutogen/ManySources/CMakeLists.txt
index df8a2a6..f9ac7db 100644
--- a/Tests/QtAutogen/ManySources/CMakeLists.txt
+++ b/Tests/QtAutogen/ManySources/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(ManySources)
include("../AutogenGuiTest.cmake")
diff --git a/Tests/QtAutogen/MocCMP0071/CMakeLists.txt b/Tests/QtAutogen/MocCMP0071/CMakeLists.txt
index 5c58a82..7ab3a8e 100644
--- a/Tests/QtAutogen/MocCMP0071/CMakeLists.txt
+++ b/Tests/QtAutogen/MocCMP0071/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(MocCMP0071)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/MocCMP0071/NEW/CMakeLists.txt b/Tests/QtAutogen/MocCMP0071/NEW/CMakeLists.txt
index 954fe3d..4375b17 100644
--- a/Tests/QtAutogen/MocCMP0071/NEW/CMakeLists.txt
+++ b/Tests/QtAutogen/MocCMP0071/NEW/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_minimum_required(VERSION 3.10)
cmake_policy(SET CMP0071 NEW)
# *Generate* files
diff --git a/Tests/QtAutogen/MocCMP0071/OLD/CMakeLists.txt b/Tests/QtAutogen/MocCMP0071/OLD/CMakeLists.txt
index 68fa067..3771487 100644
--- a/Tests/QtAutogen/MocCMP0071/OLD/CMakeLists.txt
+++ b/Tests/QtAutogen/MocCMP0071/OLD/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_minimum_required(VERSION 3.10)
cmake_policy(SET CMP0071 OLD)
# *Generate* files
diff --git a/Tests/QtAutogen/MocCMP0100/CMakeLists.txt b/Tests/QtAutogen/MocCMP0100/CMakeLists.txt
index 559cffe..b19dc6a 100644
--- a/Tests/QtAutogen/MocCMP0100/CMakeLists.txt
+++ b/Tests/QtAutogen/MocCMP0100/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(MocCMP0100)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/MocCMP0100/NEW/CMakeLists.txt b/Tests/QtAutogen/MocCMP0100/NEW/CMakeLists.txt
index 654b31e..aaaf7fb 100644
--- a/Tests/QtAutogen/MocCMP0100/NEW/CMakeLists.txt
+++ b/Tests/QtAutogen/MocCMP0100/NEW/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_minimum_required(VERSION 3.16)
cmake_policy(SET CMP0100 NEW)
add_executable(mocCMP0100New
diff --git a/Tests/QtAutogen/MocCMP0100/OLD/CMakeLists.txt b/Tests/QtAutogen/MocCMP0100/OLD/CMakeLists.txt
index 2be0535..006cda1 100644
--- a/Tests/QtAutogen/MocCMP0100/OLD/CMakeLists.txt
+++ b/Tests/QtAutogen/MocCMP0100/OLD/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_minimum_required(VERSION 3.16)
cmake_policy(SET CMP0100 OLD)
# Generate moc files externally.
diff --git a/Tests/QtAutogen/MocInclude/CMakeLists.txt b/Tests/QtAutogen/MocInclude/CMakeLists.txt
index 04c8baf..4224d2f 100644
--- a/Tests/QtAutogen/MocInclude/CMakeLists.txt
+++ b/Tests/QtAutogen/MocInclude/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.15)
+cmake_minimum_required(VERSION 3.16)
project(MocInclude)
get_filename_component(CS_REAL ${CMAKE_CURRENT_SOURCE_DIR} REALPATH)
include("${CS_REAL}/../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt b/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt
index 8b11b46..c28616b 100644
--- a/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt
+++ b/Tests/QtAutogen/MocIncludeSymlink/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.15)
+cmake_minimum_required(VERSION 3.16)
project(MocIncludeSymlink)
include("../AutogenCoreTest.cmake")
@@ -63,6 +63,7 @@ macro(buildMocInclude sourceDir binaryDir)
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
"-DCMAKE_AUTOMOC_PATH_PREFIX=ON"
"-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/MocMacroName/CMakeLists.txt b/Tests/QtAutogen/MocMacroName/CMakeLists.txt
index bf13d18..d8dc4a3 100644
--- a/Tests/QtAutogen/MocMacroName/CMakeLists.txt
+++ b/Tests/QtAutogen/MocMacroName/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(MocMacroName)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/MocOnly/CMakeLists.txt b/Tests/QtAutogen/MocOnly/CMakeLists.txt
index f4fde58..b5d405a 100644
--- a/Tests/QtAutogen/MocOnly/CMakeLists.txt
+++ b/Tests/QtAutogen/MocOnly/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(MocOnly)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/MocOptions/CMakeLists.txt b/Tests/QtAutogen/MocOptions/CMakeLists.txt
index 19ee658..169e6cb 100644
--- a/Tests/QtAutogen/MocOptions/CMakeLists.txt
+++ b/Tests/QtAutogen/MocOptions/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(MocOptions)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/MocOsMacros/CMakeLists.txt b/Tests/QtAutogen/MocOsMacros/CMakeLists.txt
index b0125f6..db44da3 100644
--- a/Tests/QtAutogen/MocOsMacros/CMakeLists.txt
+++ b/Tests/QtAutogen/MocOsMacros/CMakeLists.txt
@@ -1,10 +1,10 @@
-cmake_minimum_required(VERSION 3.11)
+cmake_minimum_required(VERSION 3.16)
project(MocOsMacros)
include("../AutogenCoreTest.cmake")
# Tests if moc processes Q_OS_XXX macros
-message( "Qt5Core_VERSION: ${Qt5Core_VERSION}" )
+message( "Qt${QT_TEST_VERSION}Core_VERSION: ${Qt${QT_TEST_VERSION}Core_VERSION}" )
message(
"CMAKE_CXX_COMPILER_PREDEFINES_COMMAND: "
${CMAKE_CXX_COMPILER_PREDEFINES_COMMAND} )
@@ -12,7 +12,7 @@ message(
# On some platforms (e.g. MAC) Q_OS_XXX requires moc to include moc_predefs.h
# which is supported since Qt 5.8 and requires
# CMAKE_CXX_COMPILER_PREDEFINES_COMMAND to be defined.
-if( ( ${Qt5Core_VERSION} VERSION_GREATER_EQUAL "5.8" ) AND
+if( ( ${Qt${QT_TEST_VERSION}Core_VERSION} VERSION_GREATER_EQUAL "5.8" ) AND
DEFINED CMAKE_CXX_COMPILER_PREDEFINES_COMMAND
)
message( "Test enabled!" )
diff --git a/Tests/QtAutogen/MocSkipSource/CMakeLists.txt b/Tests/QtAutogen/MocSkipSource/CMakeLists.txt
index c886736..b9e20c8 100644
--- a/Tests/QtAutogen/MocSkipSource/CMakeLists.txt
+++ b/Tests/QtAutogen/MocSkipSource/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(MocSkipSource)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt b/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt
index e8af6c9..88d0998 100644
--- a/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt
+++ b/Tests/QtAutogen/ObjectLibrary/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(ObjectLibrary)
include("../AutogenCoreTest.cmake")
@@ -11,7 +11,7 @@ add_subdirectory(a)
# Object library b defined locally
include_directories(b)
add_library(b OBJECT b/classb.cpp)
-target_compile_features(b PRIVATE ${QT_COMPILE_FEATURES})
+target_link_libraries(b PRIVATE ${QT_LIBRARIES})
# Executable with OBJECT library generator expressions
add_executable(someProgram main.cpp $<TARGET_OBJECTS:a> $<TARGET_OBJECTS:b>)
diff --git a/Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt b/Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt
index fe76ac3..5ace3ae 100644
--- a/Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt
+++ b/Tests/QtAutogen/ObjectLibrary/a/CMakeLists.txt
@@ -1,2 +1,2 @@
add_library(a OBJECT classa.cpp)
-target_compile_features(a PRIVATE ${QT_COMPILE_FEATURES})
+target_link_libraries(a PRIVATE ${QT_LIBRARIES})
diff --git a/Tests/QtAutogen/Parallel/CMakeLists.txt b/Tests/QtAutogen/Parallel/CMakeLists.txt
index 299bcbf..29628eb 100644
--- a/Tests/QtAutogen/Parallel/CMakeLists.txt
+++ b/Tests/QtAutogen/Parallel/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(Parallel)
include("../AutogenGuiTest.cmake")
diff --git a/Tests/QtAutogen/Parallel1/CMakeLists.txt b/Tests/QtAutogen/Parallel1/CMakeLists.txt
index 5c7d547..d94aba5 100644
--- a/Tests/QtAutogen/Parallel1/CMakeLists.txt
+++ b/Tests/QtAutogen/Parallel1/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(Parallel1)
include("../AutogenGuiTest.cmake")
diff --git a/Tests/QtAutogen/Parallel2/CMakeLists.txt b/Tests/QtAutogen/Parallel2/CMakeLists.txt
index 668aea4..58667a8 100644
--- a/Tests/QtAutogen/Parallel2/CMakeLists.txt
+++ b/Tests/QtAutogen/Parallel2/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(Parallel2)
include("../AutogenGuiTest.cmake")
diff --git a/Tests/QtAutogen/Parallel3/CMakeLists.txt b/Tests/QtAutogen/Parallel3/CMakeLists.txt
index 5c50f5e..cc3aae0 100644
--- a/Tests/QtAutogen/Parallel3/CMakeLists.txt
+++ b/Tests/QtAutogen/Parallel3/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(Parallel3)
include("../AutogenGuiTest.cmake")
diff --git a/Tests/QtAutogen/Parallel4/CMakeLists.txt b/Tests/QtAutogen/Parallel4/CMakeLists.txt
index 2c40c6a..2b81e98 100644
--- a/Tests/QtAutogen/Parallel4/CMakeLists.txt
+++ b/Tests/QtAutogen/Parallel4/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(Parallel4)
include("../AutogenGuiTest.cmake")
diff --git a/Tests/QtAutogen/ParallelAUTO/CMakeLists.txt b/Tests/QtAutogen/ParallelAUTO/CMakeLists.txt
index cddece3..5543b9a 100644
--- a/Tests/QtAutogen/ParallelAUTO/CMakeLists.txt
+++ b/Tests/QtAutogen/ParallelAUTO/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(ParallelAUTO)
include("../AutogenGuiTest.cmake")
diff --git a/Tests/QtAutogen/RccEmpty/CMakeLists.txt b/Tests/QtAutogen/RccEmpty/CMakeLists.txt
index a8e2af1..c8f9d17 100644
--- a/Tests/QtAutogen/RccEmpty/CMakeLists.txt
+++ b/Tests/QtAutogen/RccEmpty/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(RccEmpty)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt b/Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt
index 61b9601..b44973d 100644
--- a/Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt
+++ b/Tests/QtAutogen/RccOffMocLibrary/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(RccOffMocLibrary)
include("../AutogenCoreTest.cmake")
@@ -9,9 +9,7 @@ include("../AutogenCoreTest.cmake")
add_library(empty STATIC empty.cpp not_generated_file.qrc)
set_target_properties(empty PROPERTIES AUTORCC OFF)
set_target_properties(empty PROPERTIES AUTOMOC TRUE)
-target_link_libraries(empty no_link_language)
+target_link_libraries(empty PRIVATE no_link_language ${QT_LIBRARIES})
add_library(no_link_language STATIC empty.h)
set_target_properties(no_link_language PROPERTIES AUTOMOC TRUE)
-# Pass Qt compiler features to targets that don't link against Qt
-target_compile_features(no_link_language PRIVATE ${QT_COMPILE_FEATURES})
-target_compile_features(empty PRIVATE ${QT_COMPILE_FEATURES})
+target_link_libraries(no_link_language PRIVATE ${QT_LIBRARIES})
diff --git a/Tests/QtAutogen/RccOnly/CMakeLists.txt b/Tests/QtAutogen/RccOnly/CMakeLists.txt
index f3776f5..f3271e0 100644
--- a/Tests/QtAutogen/RccOnly/CMakeLists.txt
+++ b/Tests/QtAutogen/RccOnly/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(RccOnly)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/RccSkipSource/CMakeLists.txt b/Tests/QtAutogen/RccSkipSource/CMakeLists.txt
index 4223274..a79177f 100644
--- a/Tests/QtAutogen/RccSkipSource/CMakeLists.txt
+++ b/Tests/QtAutogen/RccSkipSource/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(RccSkipSource)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt
index c53e857..76dbdf5 100644
--- a/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocBasic/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(RerunMocBasic)
include("../AutogenCoreTest.cmake")
@@ -63,6 +63,7 @@ execute_process(
${_D_CMAKE_GENERATOR_INSTANCE}
"-DQT_TEST_VERSION=${QT_TEST_VERSION}"
"-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
RESULT_VARIABLE exit_code
OUTPUT_VARIABLE output
diff --git a/Tests/QtAutogen/RerunMocBasic/MocBasic/CMakeLists.txt b/Tests/QtAutogen/RerunMocBasic/MocBasic/CMakeLists.txt
index 42f2f57..e27a824 100644
--- a/Tests/QtAutogen/RerunMocBasic/MocBasic/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocBasic/MocBasic/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(MocBasic)
include("../../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt b/Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt
index 2677659..3a9244d 100644
--- a/Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocOnAddFile/CMakeLists.txt
@@ -1,6 +1,6 @@
# This test checks whether adding a source file to the project triggers an AUTOMOC re-run.
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(RerunMocOnAddFile)
include("../AutogenCoreTest.cmake")
@@ -64,6 +64,7 @@ try_compile(MOC_RERUN
MocOnAddFile
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
"-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in
index 9e5e21c..e600137 100644
--- a/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in
+++ b/Tests/QtAutogen/RerunMocOnAddFile/MocOnAddFile/CMakeLists.txt.in
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(MocOnAddFile)
include("@CMAKE_CURRENT_LIST_DIR@/../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt b/Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt
index c5811eb..b17e4c5 100644
--- a/Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocOnMissingDependency/CMakeLists.txt
@@ -1,6 +1,6 @@
# This test checks whether a missing dependency of the moc output triggers an AUTOMOC re-run.
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(RerunMocOnMissingDependency)
include("../AutogenCoreTest.cmake")
@@ -13,10 +13,10 @@ add_executable(exe "${main_source}")
set(testProjectTemplateDir "${CMAKE_CURRENT_SOURCE_DIR}/MocOnMissingDependency")
set(testProjectSrc "${CMAKE_CURRENT_BINARY_DIR}/MocOnMissingDependency")
set(testProjectBinDir "${CMAKE_CURRENT_BINARY_DIR}/MocOnMissingDependency-build")
-if(DEFINED Qt5Core_VERSION AND Qt5Core_VERSION VERSION_GREATER_EQUAL "5.15.0")
- set(moc_depfiles_supported TRUE)
+if(DEFINED Qt${QT_TEST_VERSION}Core_VERSION AND Qt${QT_TEST_VERSION}Core_VERSION VERSION_GREATER_EQUAL "5.15.0")
+ set(moc_depfiles_supported TRUE)
else()
- set(moc_depfiles_supported FALSE)
+ set(moc_depfiles_supported FALSE)
endif()
# Utility macros
@@ -48,6 +48,7 @@ try_compile(MOC_RERUN
MocOnMissingDependency
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
"-DCMAKE_AUTOGEN_VERBOSE=ON"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt
index a7fb2d7..2d2edb4 100644
--- a/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocPlugin/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(RerunMocPlugin)
include("../AutogenCoreTest.cmake")
@@ -63,6 +63,7 @@ try_compile(MOC_PLUGIN
MocPlugin
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
"-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt
index 5068289..8097fd0 100644
--- a/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunMocPlugin/MocPlugin/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(MocPlugin)
include("../../AutogenGuiTest.cmake")
@@ -22,7 +22,7 @@ configure_file(jsonIn/StyleE.json jsonFiles/StyleE_Custom.json)
set(CMAKE_AUTOMOC TRUE)
include_directories("${CMAKE_CURRENT_BINARY_DIR}/jsonFiles")
-link_libraries(Qt5::Widgets)
+link_libraries(Qt${QT_TEST_VERSION}::Widgets)
add_library(PlugA STATIC StyleA.cpp)
add_library(PlugB STATIC StyleB.cpp)
diff --git a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
index 33c01ac..1598bfd 100644
--- a/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunRccConfigChange/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.11.2)
+cmake_minimum_required(VERSION 3.16)
project(RerunRccConfigChange)
include("../AutogenCoreTest.cmake")
@@ -33,6 +33,7 @@ try_compile(RCC_DEPENDS
RccConfigChange
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
"-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt
index e2dd0ac..83f3a45 100644
--- a/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunRccConfigChange/RccConfigChange/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.11.2)
+cmake_minimum_required(VERSION 3.16)
project(RccConfigChange)
include("../../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt
index 1301550..15e38db 100644
--- a/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunRccDepends/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(RerunRccDepends)
include("../AutogenCoreTest.cmake")
@@ -66,6 +66,7 @@ try_compile(RCC_DEPENDS
RccDepends
CMAKE_FLAGS "-DQT_TEST_VERSION=${QT_TEST_VERSION}"
"-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
OUTPUT_VARIABLE output
)
diff --git a/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt b/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt
index 150f849..6bba163 100644
--- a/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunRccDepends/RccDepends/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(RccDepends)
include("../../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt b/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt
index 9b114e9..979e878 100644
--- a/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt
+++ b/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt
@@ -66,6 +66,7 @@ execute_process(
"${build_type_extra}"
"-DQT_TEST_VERSION=${QT_TEST_VERSION}"
"-DCMAKE_AUTOGEN_VERBOSE=${CMAKE_AUTOGEN_VERBOSE}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
"-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
RESULT_VARIABLE exit_code
OUTPUT_VARIABLE output
diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in
index c787db1..1775725 100644
--- a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in
+++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(UicOnFileChange)
include("@CMAKE_CURRENT_LIST_DIR@/../AutogenGuiTest.cmake")
diff --git a/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt b/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt
index f3536ba..25ea822 100644
--- a/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt
+++ b/Tests/QtAutogen/StaticLibraryCycle/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(StaticLibraryCycle)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/TestMacros.cmake b/Tests/QtAutogen/TestMacros.cmake
index 9dcf31f..529592e 100644
--- a/Tests/QtAutogen/TestMacros.cmake
+++ b/Tests/QtAutogen/TestMacros.cmake
@@ -7,8 +7,17 @@ else()
endif()
list(APPEND Autogen_BUILD_OPTIONS
"-DCMAKE_AUTOGEN_VERBOSE=1"
- "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
)
+if(Qt${QT_TEST_VERSION}Core_DIR)
+ get_filename_component(prefix "${Qt${QT_TEST_VERSION}Core_DIR}" DIRECTORY)
+ get_filename_component(prefix "${prefix}" DIRECTORY)
+ get_filename_component(prefix "${prefix}" DIRECTORY)
+ list(APPEND Autogen_BUILD_OPTIONS "-DCMAKE_PREFIX_PATH:STRING=${prefix}")
+else()
+ list(APPEND Autogen_BUILD_OPTIONS
+ "-DQT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}"
+ )
+endif()
# XXX(xcode-per-cfg-src): Drop the NO_PER_CONFIG_SOURCES exclusion
# when the Xcode generator supports per-config sources.
if(CMAKE_GENERATOR STREQUAL "Xcode")
diff --git a/Tests/QtAutogen/UicInclude/CMakeLists.txt b/Tests/QtAutogen/UicInclude/CMakeLists.txt
index 929868b..042d18f 100644
--- a/Tests/QtAutogen/UicInclude/CMakeLists.txt
+++ b/Tests/QtAutogen/UicInclude/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(UicInclude)
include("../AutogenGuiTest.cmake")
diff --git a/Tests/QtAutogen/UicInterface/CMakeLists.txt b/Tests/QtAutogen/UicInterface/CMakeLists.txt
index e022764..167ae49 100644
--- a/Tests/QtAutogen/UicInterface/CMakeLists.txt
+++ b/Tests/QtAutogen/UicInterface/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(UicInterface)
include("../AutogenGuiTest.cmake")
@@ -11,12 +11,12 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
add_library(KI18n klocalizedstring.cpp)
-target_link_libraries(KI18n ${QT_QTCORE_TARGET})
+target_link_libraries(KI18n PRIVATE ${QT_QTCORE_TARGET})
set(autouic_options
-tr tr2$<$<NOT:$<BOOL:$<TARGET_PROPERTY:NO_KUIT_SEMANTIC>>>:x>i18n
)
-if (NOT Qt5Widgets_VERSION VERSION_LESS 5.3.0)
+if (NOT Qt${QT_TEST_VERSION}Widgets_VERSION VERSION_LESS 5.3.0)
list(APPEND autouic_options -include klocalizedstring.h)
endif()
diff --git a/Tests/QtAutogen/UicNoGui/CMakeLists.txt b/Tests/QtAutogen/UicNoGui/CMakeLists.txt
index 076299d..b938a17 100644
--- a/Tests/QtAutogen/UicNoGui/CMakeLists.txt
+++ b/Tests/QtAutogen/UicNoGui/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.13)
+cmake_minimum_required(VERSION 3.16)
project(UicNoGui)
include("../AutogenCoreTest.cmake")
diff --git a/Tests/QtAutogen/UicOnly/CMakeLists.txt b/Tests/QtAutogen/UicOnly/CMakeLists.txt
index b163254..e25b44d 100644
--- a/Tests/QtAutogen/UicOnly/CMakeLists.txt
+++ b/Tests/QtAutogen/UicOnly/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(UicOnly)
include("../AutogenGuiTest.cmake")
diff --git a/Tests/QtAutogen/UicSkipSource/CMakeLists.txt b/Tests/QtAutogen/UicSkipSource/CMakeLists.txt
index dc3b7d4e..15dfe65 100644
--- a/Tests/QtAutogen/UicSkipSource/CMakeLists.txt
+++ b/Tests/QtAutogen/UicSkipSource/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.10)
+cmake_minimum_required(VERSION 3.16)
project(UicSkipSource)
include("../AutogenGuiTest.cmake")
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)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index eb2c2d9..3baa645 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -151,8 +151,23 @@ endif()
if(CMAKE_GENERATOR MATCHES "Make")
add_RunCMake_test(Make -DMAKE_IS_GNU=${MAKE_IS_GNU})
endif()
-if(CMake_TEST_Qt5)
+unset(ninja_test_with_qt_version)
+unset(ninja_qt_args)
+if(CMake_TEST_Qt6)
+ find_package(Qt6Widgets QUIET NO_MODULE)
+ if(Qt6Widgets_FOUND)
+ set(ninja_test_with_qt_version 6)
+ # Work around Qt6 not finding sibling dependencies without CMAKE_PREFIX_PATH
+ cmake_path(GET Qt6_DIR PARENT_PATH base_dir) # <base>/lib/cmake
+ cmake_path(GET base_dir PARENT_PATH base_dir) # <base>/lib
+ cmake_path(GET base_dir PARENT_PATH base_dir) # <base>
+ set(ninja_qt_args -DCMAKE_PREFIX_PATH=${base_dir})
+ endif()
+elseif(CMake_TEST_Qt5)
find_package(Qt5Widgets QUIET NO_MODULE)
+ if(Qt5Widgets_FOUND)
+ set(ninja_test_with_qt_version 5)
+ endif()
endif()
if(CMAKE_GENERATOR MATCHES "Ninja")
set(Ninja_ARGS
@@ -162,18 +177,27 @@ if(CMAKE_GENERATOR MATCHES "Ninja")
if(CMAKE_Fortran_COMPILER)
list(APPEND Ninja_ARGS -DTEST_Fortran=1)
endif()
- if(CMake_TEST_Qt5 AND Qt5Core_FOUND)
- list(APPEND Ninja_ARGS -DCMake_TEST_Qt5=1 -DQt5Core_DIR=${Qt5Core_DIR} -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
- if(Qt5Widgets_FOUND)
- list(APPEND Ninja_ARGS -DQt5Widgets_DIR=${Qt5Widgets_DIR})
- endif()
+ if(ninja_test_with_qt_version)
+ list(APPEND Ninja_ARGS
+ -DCMake_TEST_Qt_version=${ninja_test_with_qt_version}
+ -DQt${ninja_test_with_qt_version}_DIR=${Qt${ninja_test_with_qt_version}_DIR}
+ -DQt${ninja_test_with_qt_version}Core_DIR=${Qt${ninja_test_with_qt_version}Core_DIR}
+ -DCMake_TEST_Qt${ninja_test_with_qt_version}Core_Version=${Qt${ninja_test_with_qt_version}Core_VERSION}
+ -DQt${ninja_test_with_qt_version}Widgets_DIR=${Qt${ninja_test_with_qt_version}Widgets_DIR}
+ ${ninja_qt_args}
+ )
endif()
add_RunCMake_test(Ninja)
set(NinjaMultiConfig_ARGS
-DCYGWIN=${CYGWIN} -DMSYS=${MSYS}
)
- if(CMake_TEST_Qt5 AND Qt5Core_FOUND)
- list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_Qt5=1 -DQt5Core_DIR=${Qt5Core_DIR} -DCMAKE_TEST_Qt5Core_Version=${Qt5Core_VERSION})
+ if(ninja_test_with_qt_version)
+ list(APPEND NinjaMultiConfig_ARGS
+ -DCMake_TEST_Qt_version=${ninja_test_with_qt_version}
+ -DQt${ninja_test_with_qt_version}Core_DIR=${Qt${ninja_test_with_qt_version}Core_DIR}
+ -DCMake_TEST_Qt${ninja_test_with_qt_version}Core_Version=${Qt${ninja_test_with_qt_version}Core_VERSION}
+ ${ninja_qt_args}
+ )
endif()
if(DEFINED CMake_TEST_CUDA)
list(APPEND NinjaMultiConfig_ARGS -DCMake_TEST_CUDA=${CMake_TEST_CUDA})
@@ -205,11 +229,29 @@ add_RunCMake_test(AndroidTestUtilities)
if(CMake_TEST_APPLE_SILICON)
add_RunCMake_test(AppleSilicon)
endif()
-set(autogen_with_qt5 FALSE)
+set(want_NoQt_test TRUE)
+if(CMake_TEST_Qt6 AND Qt6Widgets_FOUND)
+ # Work around Qt6 not finding sibling dependencies without CMAKE_PREFIX_PATH
+ cmake_path(GET Qt6_DIR PARENT_PATH base_dir) # <base>/lib/cmake
+ cmake_path(GET base_dir PARENT_PATH base_dir) # <base>/lib
+ cmake_path(GET base_dir PARENT_PATH base_dir) # <base>
+ add_RunCMake_test(AutogenQt6 TEST_DIR Autogen
+ -Dwith_qt_version=6
+ "-DQt6_DIR:PATH=${Qt6_DIR}"
+ "-DCMAKE_PREFIX_PATH:STRING=${base_dir}"
+ )
+ set(want_NoQt_test FALSE)
+endif ()
if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND)
- set(autogen_with_qt5 TRUE)
+ add_RunCMake_test(AutogenQt5 TEST_DIR Autogen
+ -Dwith_qt_version=5
+ "-DQt5_DIR:PATH=${Qt5_DIR}"
+ )
+ set(want_NoQt_test FALSE)
endif ()
-add_RunCMake_test(Autogen -Dwith_qt5=${autogen_with_qt5})
+if(want_NoQt_test)
+ add_RunCMake_test(AutogenNoQt TEST_DIR Autogen)
+endif()
add_RunCMake_test(ArtifactOutputDirs)
diff --git a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake b/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake
deleted file mode 100644
index 46b840f..0000000
--- a/Tests/RunCMake/Ninja/Qt5AutoMocDeps.cmake
+++ /dev/null
@@ -1,21 +0,0 @@
-enable_language(CXX)
-
-find_package(Qt5Core REQUIRED)
-
-set(CMAKE_AUTOMOC ON)
-
-add_library(simple_lib SHARED simple_lib.cpp)
-add_executable(app_with_qt app.cpp app_qt.cpp)
-target_link_libraries(app_with_qt PRIVATE simple_lib Qt5::Core)
-
-if(Qt5Widgets_DIR)
- find_package(Qt5Widgets REQUIRED)
- qt5_wrap_ui(_headers MyWindow.ui)
- add_executable(app_with_widget app.cpp MyWindow.cpp ${_headers})
- target_link_libraries(app_with_widget PRIVATE Qt5::Widgets)
- target_include_directories(app_with_widget PRIVATE "${CMAKE_BINARY_DIR}")
-endif()
-
-add_subdirectory(QtSubDir1)
-add_subdirectory(QtSubDir2)
-add_subdirectory(QtSubDir3)
diff --git a/Tests/RunCMake/Ninja/QtAutoMocDeps.cmake b/Tests/RunCMake/Ninja/QtAutoMocDeps.cmake
new file mode 100644
index 0000000..c441169
--- /dev/null
+++ b/Tests/RunCMake/Ninja/QtAutoMocDeps.cmake
@@ -0,0 +1,27 @@
+enable_language(CXX)
+
+set(QtX Qt${with_qt_version})
+
+find_package(${QtX} REQUIRED COMPONENTS Core)
+
+set(CMAKE_AUTOMOC ON)
+
+add_library(simple_lib SHARED simple_lib.cpp)
+add_executable(app_with_qt app.cpp app_qt.cpp)
+target_link_libraries(app_with_qt PRIVATE simple_lib ${QtX}::Core)
+
+if(${QtX}Widgets_DIR)
+ find_package(${QtX} REQUIRED COMPONENTS Widgets)
+ if(with_qt_version STREQUAL 5)
+ qt5_wrap_ui(_headers MyWindow.ui)
+ else()
+ qt_wrap_ui(_headers MyWindow.ui)
+ endif()
+ add_executable(app_with_widget app.cpp MyWindow.cpp ${_headers})
+ target_link_libraries(app_with_widget PRIVATE ${QtX}::Widgets)
+ target_include_directories(app_with_widget PRIVATE "${CMAKE_BINARY_DIR}")
+endif()
+
+add_subdirectory(QtSubDir1)
+add_subdirectory(QtSubDir2)
+add_subdirectory(QtSubDir3)
diff --git a/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt
index 64016b6..3a12dcd 100644
--- a/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt
+++ b/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_policy(SET CMP0116 OLD)
add_executable(sub_exe_1 ../app.cpp)
-target_link_libraries(sub_exe_1 PRIVATE Qt5::Core)
+target_link_libraries(sub_exe_1 PRIVATE ${QtX}::Core)
diff --git a/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt
index 3176426..a2f77e4 100644
--- a/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt
+++ b/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt
@@ -1,4 +1,4 @@
cmake_policy(SET CMP0116 NEW)
add_executable(sub_exe_2 ../app.cpp)
-target_link_libraries(sub_exe_2 PRIVATE Qt5::Core)
+target_link_libraries(sub_exe_2 PRIVATE ${QtX}::Core)
diff --git a/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt
index d38cfe0..70644fa 100644
--- a/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt
+++ b/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt
@@ -1,2 +1,2 @@
add_executable(sub_exe_3 ../app.cpp)
-target_link_libraries(sub_exe_3 PRIVATE Qt5::Core)
+target_link_libraries(sub_exe_3 PRIVATE ${QtX}::Core)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 3f239b9..2a5b556 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -319,12 +319,17 @@ function (run_ChangeBuildType)
endfunction()
run_ChangeBuildType()
-function(run_Qt5AutoMocDeps)
- if(CMake_TEST_Qt5 AND CMAKE_TEST_Qt5Core_Version VERSION_GREATER_EQUAL 5.15.0)
- set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/Qt5AutoMocDeps-build)
- set(RunCMake_TEST_OPTIONS "-DQt5Core_DIR=${Qt5Core_DIR}" "-DQt5Widgets_DIR=${Qt5Widgets_DIR}")
- run_cmake(Qt5AutoMocDeps)
- unset(RunCMake_TEST_OPTIONS)
+function(run_QtAutoMocDeps)
+ set(QtX Qt${CMake_TEST_Qt_version})
+ if(CMake_TEST_${QtX}Core_Version VERSION_GREATER_EQUAL 5.15.0)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/QtAutoMocDeps-build)
+ run_cmake_with_options(QtAutoMocDeps
+ "-Dwith_qt_version=${CMake_TEST_Qt_version}"
+ "-D${QtX}_DIR=${${QtX}_DIR}"
+ "-D${QtX}Core_DIR=${${QtX}Core_DIR}"
+ "-D${QtX}Widgets_DIR=${${QtX}Widgets_DIR}"
+ "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
+ )
# Build the project.
run_ninja("${RunCMake_TEST_BINARY_DIR}")
# Touch just the library source file, which shouldn't cause a rerun of AUTOMOC
@@ -352,4 +357,6 @@ function(run_Qt5AutoMocDeps)
run_ninja("${RunCMake_TEST_BINARY_DIR}")
endif()
endfunction()
-run_Qt5AutoMocDeps()
+if(CMake_TEST_Qt_version)
+ run_QtAutoMocDeps()
+endif()
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()