summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2019-08-22 16:20:03 +0200
committerLeander Beernaert <leander.beernaert@qt.io>2019-08-23 09:31:39 +0000
commitacdc5dfaee8502f12486204fd2f01ba7eb0bbbfd (patch)
tree0920eff5c89cf0951a041af73acf352b5621a8bf
parent8b800dc38493ad6dbf95867639d93128bf176f40 (diff)
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
-rw-r--r--cmake/QtBuild.cmake31
1 files changed, 17 insertions, 14 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 53ed719430..aad4fe6da4 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -2322,24 +2322,27 @@ function(add_qt_test name)
endif()
if(builtin_testdata)
- target_compile_definitions("${name}" PRIVATE 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)
- list(APPEND builtin_files ${testdata})
- endforeach()
+ foreach(testdata IN LISTS arg_TESTDATA)
+ list(APPEND builtin_files ${testdata})
+ endforeach()
- set(blacklist_path "BLACKLIST")
- if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${blacklist_path}")
- list(APPEND builtin_files ${blacklist_path})
- endif()
+ set(blacklist_path "BLACKLIST")
+ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${blacklist_path}")
+ list(APPEND builtin_files ${blacklist_path})
+ endif()
- list(REMOVE_DUPLICATES builtin_files)
+ list(REMOVE_DUPLICATES builtin_files)
- if (builtin_files)
- add_qt_resource(${name} "testdata"
- PREFIX "/"
- FILES ${builtin_files}
- BASE ${CMAKE_CURRENT_SOURCE_DIR})
+ if (builtin_files)
+ add_qt_resource(${name} "testdata"
+ PREFIX "/"
+ FILES ${builtin_files}
+ BASE ${CMAKE_CURRENT_SOURCE_DIR})
+ endif()
endif()
else()
# Install test data