summaryrefslogtreecommitdiffstats
path: root/cmake/QtTestHelpers.cmake
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2022-11-29 16:19:54 +0100
committerMikolaj Boc <mikolaj.boc@qt.io>2022-12-01 08:52:44 +0100
commit65b7aacb4051d82bf0cb8bfc684f3404dd0bc4a7 (patch)
tree7cd071182908af40cddb6509050a2404e9f89a28 /cmake/QtTestHelpers.cmake
parenta395d08c3b3be965c83d0d0fe900d27e9972d9ad (diff)
Add a dummy target for tests that get batched
This is done to avoid cmake syntax errors when adding new tests. Change-Id: I8106b13a865b990c52e09573488881bd18e64c7f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtTestHelpers.cmake')
-rw-r--r--cmake/QtTestHelpers.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake
index 81a2c7b9ba..b8b2485175 100644
--- a/cmake/QtTestHelpers.cmake
+++ b/cmake/QtTestHelpers.cmake
@@ -371,6 +371,16 @@ function(qt_internal_add_test_to_batch batch_name name)
"BATCHED_TEST_NAME=\"${name}\"")
endforeach()
set(${batch_name} ${target} PARENT_SCOPE)
+
+ # Add a dummy target so that new tests don't have problems with a nonexistent
+ # target when calling cmake functions.
+ # The batch tests that include this target will compile, but may fail to work.
+ # Manual action is required then.
+ add_custom_target(${name})
+
+ # Add the dependency to the dummy target so that it is indirectly added to the test batch
+ # dependencies.
+ add_dependencies(${target} ${name})
endfunction()
# Checks whether the test 'name' is present in the test batch. See QT_BUILD_TESTS_BATCHED.