CMake: Fix _qt_is_test_executable assignment for tests

_qt_is_test_executable can only be set on a test that is backed by a
real target. QMLTESTs might not backed by an executable target, if
they are missing cpp SOURCES.

Which led to errors like

 CMake Error at
  cmake/QtTestHelpers.cmake:510
 (set_target_properties):
  set_target_properties Can not find target to add properties to:
  textedit
 Call Stack (most recent call first):
  tests/auto/qmltest/textedit/CMakeLists.txt:10 (qt_internal_add_test)

Amends 62c681a599

Change-Id: Ie66fd3e94484562061f851c0a034629959d091da
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2022-09-16 17:53:41 +02:00
parent 0e90bdbaa4
commit 469dbe5c6d

View File

@ -297,6 +297,7 @@ function(qt_internal_add_test_to_batch batch_name name)
set_property(TARGET ${target} PROPERTY _qt_has_gui ${arg_GUI})
set_property(TARGET ${target} PROPERTY _qt_has_lowdpi ${arg_LOWDPI})
set_property(TARGET ${target} PROPERTY _qt_version ${version_arg})
set_property(TARGET ${target} PROPERTY _qt_is_test_executable TRUE)
else()
# Check whether the args match with the batch. Some differences between
# flags cannot be reconciled - one should not combine these tests into
@ -506,8 +507,8 @@ function(qt_internal_add_test name)
LIBRARIES ${QT_CMAKE_EXPORT_NAMESPACE}::Gui
)
set(setting_up_batched_test FALSE)
set_target_properties(${name} PROPERTIES _qt_is_test_executable TRUE)
endif()
set_target_properties(${name} PROPERTIES _qt_is_test_executable TRUE)
foreach(path IN LISTS arg_QML_IMPORTPATH)
list(APPEND extra_test_args "-import" "${path}")