Skip emebedding test data when there is no target

On android test data is embedded into to the binary via resources. This
will not work with sourceless tests such as the qml only test cases.

Change-Id: I3ecf28223b3c7c6dae4ca3f15519adc028082598
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CMake Build Bot
This commit is contained in:
Leander Beernaert 2019-08-22 16:20:03 +02:00
parent 8b800dc384
commit acdc5dfaee

View File

@ -2322,6 +2322,8 @@ function(add_qt_test name)
endif()
if(builtin_testdata)
# Safe guard against qml only tests, no source files == no target
if (TARGET "${name}")
target_compile_definitions("${name}" PRIVATE BUILTIN_TESTDATA)
foreach(testdata IN LISTS arg_TESTDATA)
@ -2341,6 +2343,7 @@ function(add_qt_test name)
FILES ${builtin_files}
BASE ${CMAKE_CURRENT_SOURCE_DIR})
endif()
endif()
else()
# Install test data
file(RELATIVE_PATH relative_path_to_test_project