diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2021-12-29 17:41:08 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-01-12 06:41:47 +0000 |
commit | 799c9743cde41f6d7ccae77e8e01d6e37d4e54ce (patch) | |
tree | 6eb1ef01d7e4682e21200475e38b68209738fcc4 | |
parent | 1d4fba75f83882ea570a8ef57b48907f7927399c (diff) | |
download | qtwebchannel-799c9743cde41f6d7ccae77e8e01d6e37d4e54ce.tar.gz |
Re-enable cmake build test for qtwebchannel
Task-number: QTBUG-92967
Change-Id: Ie104331b7dd375fae3b448de7767550ffb9f4c29
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 77ee35809d5ec7363472aa07f3cf49b3d5be5cd8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | tests/auto/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/auto/cmake/CMakeLists.txt | 42 |
2 files changed, 35 insertions, 14 deletions
diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt index 716f70c..5bafad0 100644 --- a/tests/auto/CMakeLists.txt +++ b/tests/auto/CMakeLists.txt @@ -1,9 +1,4 @@ -# Generated from auto.pro. - -# special case begin -# Qt5 cmake tests -#add_subdirectory(cmake) -# special case end +add_subdirectory(cmake) add_subdirectory(webchannel) if(TARGET Qt::Quick) add_subdirectory(qml) diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index d5cf499..ff35cfc 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -1,18 +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(webchannel_cmake_tests) +enable_testing() -project(qmake_cmake_files) +set(required_packages Core WebChannel) -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() -# Qt5Qml is an optional dependency of QWebChannel headers. Make sure we find it -# in the test. -set(Qt5_MODULE_TEST_DEPENDS Qml) +include("${_Qt6CTestMacros}") -test_module_includes( +set(module_includes WebChannel QWebChannel ) + +_qt_internal_test_module_includes( + ${module_includes} +) |