summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2022-02-08 15:25:52 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-02-10 13:29:03 +0000
commit06c0250baebd7e346cd7305794633a5287ef4a1e (patch)
tree9f5f64c49cebd1f8aee05cd4e2183ea777fa2ff0 /cmake
parente8478559336fa96b90262e924061138bcca198a2 (diff)
Fix the run of _check targets in multi-config builds
With Ninja Multi-Config generator it's necessary to provide the '-C' option matching the build configuration when running ctest. This patchset adds the missing option to the command line of the '_check' targets. Change-Id: I42acfba26a09877a6d3a5be9230860f15f95a0cd Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 3bee7db4198712c763dbd754bad7b2c851147038) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtTestHelpers.cmake10
1 files changed, 8 insertions, 2 deletions
diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake
index e85c4e4397..c9d2d3c9b1 100644
--- a/cmake/QtTestHelpers.cmake
+++ b/cmake/QtTestHelpers.cmake
@@ -346,10 +346,16 @@ function(qt_internal_add_test name)
endif()
# Add a ${target}/check makefile target, to more easily test one test.
+
+ set(test_config_options "")
+ get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
+ if(is_multi_config)
+ set(test_config_options -C $<CONFIG>)
+ endif()
add_custom_target("${name}_check"
VERBATIM
- COMMENT "Running ${CMAKE_CTEST_COMMAND} -V -R \"^${name}$\""
- COMMAND "${CMAKE_CTEST_COMMAND}" -V -R "^${name}$"
+ COMMENT "Running ${CMAKE_CTEST_COMMAND} -V -R \"^${name}$\" ${test_config_options}"
+ COMMAND "${CMAKE_CTEST_COMMAND}" -V -R "^${name}$" ${test_config_options}
)
if(TARGET "${name}")
add_dependencies("${name}_check" "${name}")