From 53bee75001b8b64868922f7bf5e95ea97fe3859d Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 3 Jun 2020 11:58:17 +0200 Subject: CMake: Fix tst_foo_check to work for qml tests as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- cmake/QtBuild.cmake | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'cmake') 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 /bin, as well as CMAKE_INSTALL_PREFIX/bin, then # prepend them to the PATH environment variable. -- cgit v1.2.3