summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-06-03 11:58:17 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-06-03 18:20:02 +0200
commit53bee75001b8b64868922f7bf5e95ea97fe3859d (patch)
tree0696063ebc14b464552a86a8a552e1bdc6460cb1 /cmake
parentd268b919071863d2a5287b64304e77ade07d55d3 (diff)
CMake: Fix tst_foo_check to work for qml tests as well
Qml tests currently don't expose a CMake target, so no dependency should be added to a non-existent target. Make sure to add the check target only if the test was previously added. Fixes configurtion failure of qtdeclarative tests. Amends 873aa682c56b1c187e2c87b49050509db9d1b16b Change-Id: Ic8bbfe668c00c1ce05f1e1dfe5494dafd91dd7b8 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake16
1 files changed, 10 insertions, 6 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 941ee1223a..cb68fc2721 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -3699,12 +3699,16 @@ function(qt_add_test name)
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}")
+ if(TEST "${name}")
+ add_custom_target("${name}_check"
+ VERBATIM
+ COMMENT "Running ${CMAKE_CTEST_COMMAND} -V -R \"^${name}$\""
+ COMMAND "${CMAKE_CTEST_COMMAND}" -V -R "^${name}$"
+ )
+ if(TARGET "${name}")
+ add_dependencies("${name}_check" "${name}")
+ endif()
+ endif()
# Get path to <qt_relocatable_install_prefix>/bin, as well as CMAKE_INSTALL_PREFIX/bin, then
# prepend them to the PATH environment variable.