diff options
author | Juha Vuolle <juha.vuolle@insta.fi> | 2021-05-03 09:08:33 +0300 |
---|---|---|
committer | Juha Vuolle <juha.vuolle@insta.fi> | 2021-05-11 14:45:01 +0300 |
commit | 6fedee75527799ce53e479710bee44737807f9dd (patch) | |
tree | e7c189850dbbe9dba0c52ebe07508a5f52490a70 /tests | |
parent | 20f23573b6129c26e90d0de9b9a025d464519466 (diff) |
Port cmake autotest to Qt6
The cmake test verifies the basic building of applications outside of
the repository. This is an important test as it is similar to how
the typical users of Qt build their projects.
Task-number: QTBUG-92967
Change-Id: Idad46a09efe769ce9372783c03020d024fdebfd6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/cmake/CMakeLists.txt | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt index 8b137891..1f9ca485 100644 --- a/tests/auto/cmake/CMakeLists.txt +++ b/tests/auto/cmake/CMakeLists.txt @@ -1 +1,45 @@ +# 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(serialport_cmake_tests) +enable_testing() + +set(required_packages Core SerialPort) + +# 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}) + +# Setup common test variables which were previously set by ctest_testcase_common.prf. +set(CMAKE_MODULES_UNDER_TEST "${required_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 + SerialPort QSerialPort +) + +_qt_internal_test_module_includes( + ${module_includes} +) |