summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@insta.fi>2021-12-29 17:57:48 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-12 06:41:20 +0000
commit13aec37ee594a422d7930c00b43ddbb2aaf189d1 (patch)
treee7689e4ce7ceaecb3ab9d1d3b4ba3f9ff514bbea
parent3497142a059f10ac03c697e0c2c0e462f3e157a3 (diff)
downloadqtwebsockets-13aec37ee594a422d7930c00b43ddbb2aaf189d1.tar.gz
Re-enable cmake build test for qtwebsockets
Task-number: QTBUG-92967 Change-Id: I2c138fd2614c08936e4253ec58c82d282cd726f3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit 8d7d0c16302597f36a45da83f92ff7e003cbfd1c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/CMakeLists.txt4
-rw-r--r--tests/auto/cmake/CMakeLists.txt40
2 files changed, 36 insertions, 8 deletions
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt
index b9730a2..e825a43 100644
--- a/tests/auto/CMakeLists.txt
+++ b/tests/auto/CMakeLists.txt
@@ -1,6 +1,4 @@
-# Generated from auto.pro.
-
-# add_subdirectory(cmake) # special case remove
+add_subdirectory(cmake)
add_subdirectory(websockets)
if(TARGET Qt::Quick)
add_subdirectory(qml)
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
index 0b70c4c..50afc7c 100644
--- a/tests/auto/cmake/CMakeLists.txt
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -1,14 +1,44 @@
+# 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.16)
+project(websockets_cmake_tests)
+enable_testing()
-project(qmake_cmake_files)
+set(required_packages Core WebSockets)
-enable_testing()
+# Setup the test when called as a completely standalone project.
+if(TARGET Qt6::Core)
+ # Tests are built as part of the repository's 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(Qt5Core REQUIRED)
+# Setup common test variables which were previously set by ctest_testcase_common.prf.
+set(CMAKE_MODULES_UNDER_TEST "${required_packages}")
-include("${_Qt5CTestMacros}")
+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()
-test_module_includes(
+include("${_Qt6CTestMacros}")
+
+set(module_includes
WebSockets QWebSocket
)
+
+_qt_internal_test_module_includes(
+ ${module_includes}
+)