aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/CMakeLists.txt5
-rw-r--r--tests/auto/cmake/CMakeLists.txt99
-rw-r--r--tests/auto/cmake/test_plugins/CMakeLists.txt17
3 files changed, 69 insertions, 52 deletions
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
index 6701df3016..3d89d8b396 100644
--- a/tests/auto/CMakeLists.txt
+++ b/tests/auto/CMakeLists.txt
@@ -7,10 +7,7 @@ if(TARGET Qt::Quick)
endif()
add_subdirectory(core)
add_subdirectory(qmldevtools)
-# special case begin
-# add_subdirectory(cmake)
-# add_subdirectory(installed_cmake)
-# special case end
+add_subdirectory(cmake)
add_subdirectory(toolsupport)
if(NOT UIKIT)
add_subdirectory(qmltest)
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index de776e9dd1..48093d749a 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -1,41 +1,64 @@
-cmake_minimum_required(VERSION 2.8)
-
-project(qmake_cmake_files)
+# This is an automatic test for the CMake configuration files.
+# To run it manually,
+# 1) mkdir build # Create a build directory
+# 2) cd build
+# 3) # Run cmake on this directory
+# `$qt_prefix/bin/qt-cmake ..` or `cmake -DCMAKE_PREFIX_PATH=/path/to/qt ..`
+# 4) ctest # Run ctest
+cmake_minimum_required(VERSION 3.14)
+project(qtdeclarative_cmake_tests)
enable_testing()
-find_package(Qt5Core REQUIRED)
-
-include("${_Qt5CTestMacros}")
-
-test_module_includes(
- Qml QQmlEngine
- Quick QQuickWindow
-)
-
-expect_pass(test_plugins)
-
-add_test(qtquickcompiler ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMAKE_CURRENT_SOURCE_DIR}/qtquickcompiler/"
- "${CMAKE_CURRENT_BINARY_DIR}/qtquickcompiler"
- --build-config "${CMAKE_BUILD_TYPE}"
- --build-generator ${CMAKE_GENERATOR}
- --build-makeprogram ${CMAKE_MAKE_PROGRAM}
- --build-project qqc_test
- --build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ${BUILD_OPTIONS_LIST}
- --test-command qqc_test
-
-)
-
-add_test(qmlimportscanner ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMAKE_CURRENT_SOURCE_DIR}/qmlimportscanner/"
- "${CMAKE_CURRENT_BINARY_DIR}/qmlimportscanner"
- --build-config "${CMAKE_BUILD_TYPE}"
- --build-generator ${CMAKE_GENERATOR}
- --build-makeprogram ${CMAKE_MAKE_PROGRAM}
- --build-project qis_test
- --build-options "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" ${BUILD_OPTIONS_LIST}
- --test-command qis_test
-)
+set(required_packages Core)
+set(optional_packages Qml Quick)
+
+# Setup the test when called as a completely standalone project.
+if(TARGET Qt6::Core)
+ # Tests are built as part of the qtsensors build tree.
+ # Setup paths so that the Qt packages are found.
+ qt_internal_set_up_build_dir_package_paths()
+endif()
+
+find_package(Qt6 REQUIRED COMPONENTS ${required_packages})
+find_package(Qt6 OPTIONAL_COMPONENTS ${optional_packages})
+
+# Setup common test variables which were previously set by ctest_testcase_common.prf.
+set(CMAKE_MODULES_UNDER_TEST "${required_packages}" "${optional_packages}")
+
+foreach(qt_package ${CMAKE_MODULES_UNDER_TEST})
+ set(package_name "${QT_CMAKE_EXPORT_NAMESPACE}${qt_package}")
+ if(${package_name}_FOUND)
+ set(CMAKE_${qt_package}_MODULE_MAJOR_VERSION "${${package_name}_VERSION_MAJOR}")
+ set(CMAKE_${qt_package}_MODULE_MINOR_VERSION "${${package_name}_VERSION_MINOR}")
+ set(CMAKE_${qt_package}_MODULE_PATCH_VERSION "${${package_name}_VERSION_PATCH}")
+ endif()
+endforeach()
+
+include("${_Qt6CTestMacros}")
+
+set(module_includes "")
+
+if(TARGET Qt::Qml)
+ list(APPEND module_includes
+ Qml QQmlEngine
+ )
+endif()
+
+if(TARGET Qt::Quick)
+ list(APPEND module_includes
+ Quick QQuickWindow
+ )
+endif()
+
+_qt_internal_test_module_includes(${module_includes})
+
+# TODO: Plugin targets are not available in shared builds at the moment QTBUG-94066
+if(TARGET Qt::Qml AND NOT QT6_IS_SHARED_LIBS_BUILD)
+ _qt_internal_test_expect_pass(test_plugins)
+endif()
+
+if(TARGET Qt::Quick)
+ # _qt_internal_test_expect_pass(qtquickcompiler) # TODO: Replace with 6.2 qml module API
+ # _qt_internal_test_expect_pass(qmlimportscanner) # TODO: Replace with 6.2 qml module API
+endif()
diff --git a/tests/auto/cmake/test_plugins/CMakeLists.txt b/tests/auto/cmake/test_plugins/CMakeLists.txt
index a23f9c332c..4d41ec693f 100644
--- a/tests/auto/cmake/test_plugins/CMakeLists.txt
+++ b/tests/auto/cmake/test_plugins/CMakeLists.txt
@@ -1,16 +1,13 @@
-project(test_plugins)
+cmake_minimum_required(VERSION 3.14)
-cmake_minimum_required(VERSION 2.8)
-if (POLICY CMP0056)
- cmake_policy(SET CMP0056 NEW)
-endif()
+project(check_for_existence_of_plugin_targets)
-find_package(Qt5Qml REQUIRED)
+find_package(Qt6 COMPONENTS REQUIRED Qml)
# See QTBUG-43438
-if (NOT TARGET Qt5::QTcpServerConnectionFactory)
- message(SEND_ERROR "Qt5::QTcpServerConnectionFactory does not exist")
+if(NOT TARGET Qt6::QTcpServerConnectionFactoryPlugin)
+ message(FATAL_ERROR "Qt6::QTcpServerConnectionFactoryPlugin does not exist")
endif()
-if (NOT TARGET Qt5::QLocalClientConnectionFactory)
- message(SEND_ERROR "Qt5::QLocalClientConnectionFactory does not exist")
+if(NOT TARGET Qt6::QLocalClientConnectionFactoryPlugin)
+ message(FATAL_ERROR "Qt6::QLocalClientConnectionFactoryPlugin does not exist")
endif()