Only add defines for sources in batched target

When encountering a batchable target, only add its defines to the
sources that the target contains. Otherwise, the defines interfere
with other tests in the batch.

Fixes: QTBUG-109848
Change-Id: I35d1665d29bb0ce93b82059f7f3b715070539d21
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Mikolaj Boc 2023-01-05 15:26:21 +01:00
parent daba0b8c19
commit c107525edb

View File

@ -352,8 +352,6 @@ function(qt_internal_add_test_to_batch batch_name name)
PUBLIC_LIBRARIES ${arg_PUBLIC_LIBRARIES}
LIBRARIES ${arg_LIBRARIES}
SOURCES ${arg_SOURCES}
DEFINES
${arg_DEFINES}
COMPILE_OPTIONS ${arg_COMPILE_OPTIONS}
COMPILE_FLAGS ${arg_COMPILE_FLAGS}
LINK_OPTIONS ${arg_LINK_OPTIONS}
@ -368,7 +366,7 @@ function(qt_internal_add_test_to_batch batch_name name)
set_source_files_properties(${source}
TARGET_DIRECTORY ${target}
PROPERTIES COMPILE_DEFINITIONS
"BATCHED_TEST_NAME=\"${name}\"")
"BATCHED_TEST_NAME=\"${name}\";${arg_DEFINES}" )
endforeach()
set(${batch_name} ${target} PARENT_SCOPE)