summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-05-29 19:50:06 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-06-02 12:03:27 +0200
commit873aa682c56b1c187e2c87b49050509db9d1b16b (patch)
tree2e2479930d8daa6d887679a40d75679cf878adad /cmake
parentf19650cf8032a7752b1a2a3c148fc5e9a6892041 (diff)
CMake: Add ${tst_foo}_check target for easy test running
Given a test named "tst_qdrag", you can run "ninja tst_qdrag_check" to build and run the test. Change-Id: I47dccb39dd60fca9cb07ff9af9fb739b293c5aaf Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 8081c7140f..a89ef60994 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -3692,6 +3692,14 @@ function(qt_add_test name)
set_tests_properties(${name} PROPERTIES TIMEOUT ${arg_TIMEOUT})
endif()
+ # Add a ${target}/check makefile target, to more easily test one test.
+ add_custom_target("${name}_check"
+ VERBATIM
+ COMMENT "Running ${CMAKE_CTEST_COMMAND} -V -R \"^${name}$\""
+ COMMAND "${CMAKE_CTEST_COMMAND}" -V -R "^${name}$"
+ )
+ add_dependencies("${name}_check" "${name}")
+
# Get path to <qt_relocatable_install_prefix>/bin, as well as CMAKE_INSTALL_PREFIX/bin, then
# prepend them to the PATH environment variable.
# It's needed on Windows to find the shared libraries and plugins.