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>
This commit is contained in:
Mikolaj Boc 2022-11-29 16:19:54 +01:00
parent a395d08c3b
commit 65b7aacb40

View File

@ -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.