diff options
author | Volker Krause <vkrause@kde.org> | 2022-01-23 13:06:05 +0100 |
---|---|---|
committer | Volker Krause <vkrause@kde.org> | 2022-01-23 14:04:59 +0100 |
commit | 33e3c5eb41ee9c5c3ea326e0b788f9efbfcf2e30 (patch) | |
tree | 5cc276081567bf4ff75821426bf65625d7429f2a /tests/CMakeLists.txt | |
parent | 104e5fabae121155511309380bafe1c49db9089a (diff) | |
download | extra-cmake-modules-33e3c5eb41ee9c5c3ea326e0b788f9efbfcf2e30.tar.gz extra-cmake-modules-33e3c5eb41ee9c5c3ea326e0b788f9efbfcf2e30.tar.bz2 |
Forward the Qt6 build option to the CMake test runs
Fixes a number of unit tests that rely on Qt in some form when using Qt6.
Diffstat (limited to 'tests/CMakeLists.txt')
-rw-r--r-- | tests/CMakeLists.txt | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f5e114c0..67d878cb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -37,12 +37,23 @@ add_subdirectory(ECMGenerateHeadersTest) add_subdirectory(ECMSetupVersionTest) add_subdirectory(ECMGeneratePkgConfigFile) +if (TARGET Qt6::Core) + set(QT_VERSION_OPT "-DBUILD_WITH_QT6=ON") +else() + set(QT_VERSION_OPT "-DBUILD_WITH_QT6=OFF") +endif() + # a macro for tests that have a simple format where the name matches the # directory and project macro(add_test_variant NAME BASE COMMAND) string(REPLACE "." "/" src_dir "${BASE}") string(REPLACE "." "/" build_dir "${NAME}") string(REGEX REPLACE "[^.]*\\." "" proj "${NAME}") + if (NOT ${NAME}_EXTRA_OPTIONS) + set(_build_opts --build-options ${QT_VERSION_OPT}) + else() + set(_build_opts ${${NAME}_EXTRA_OPTIONS} ${QT_VERSION_OPT}) + endif() add_test(${NAME} ${CMAKE_CTEST_COMMAND} --build-and-test "${CMAKE_CURRENT_SOURCE_DIR}/${src_dir}" @@ -51,7 +62,7 @@ macro(add_test_variant NAME BASE COMMAND) --build-generator ${CMAKE_GENERATOR} --build-makeprogram ${CMAKE_MAKE_PROGRAM} --build-project ${proj} - ${${NAME}_EXTRA_OPTIONS} + ${_build_opts} --test-command ${COMMAND} ${ARGN}) endmacro() macro(add_test_macro NAME) |