From 469dbe5c6d42b3b814d0b99e162c137451222c07 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 16 Sep 2022 17:53:41 +0200 Subject: [PATCH] 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 62c681a5991b7f215e108f74c1dd3dd58c1d92c7 Change-Id: Ie66fd3e94484562061f851c0a034629959d091da Reviewed-by: Alexey Edelev --- cmake/QtTestHelpers.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake index 1ab70d290d..657bb160de 100644 --- a/cmake/QtTestHelpers.cmake +++ b/cmake/QtTestHelpers.cmake @@ -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}")