From cb20cbd3c81ddc0c74d75279a19ee7c86287a78a Mon Sep 17 00:00:00 2001 From: Mikolaj Boc Date: Mon, 2 Jan 2023 19:19:44 +0100 Subject: [PATCH] Make qt cmake functions react properly to batch dummy targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stub targets introduced in 65b7aacb make the old batch target detecting measure in qt_internal_extend_target, qt_internal_undefine_global_definition, qt_internal_add_resource obsolete, since now the targets actually exist in the build system. Unconditionally fail if the target does not exist and if it does, query for its inclusion in the batch Change-Id: I1cd1d8cc7fbf4bdbd2289a1b38ecbea1e93a06c8 Reviewed-by: Jörg Bornemann --- cmake/QtResourceHelpers.cmake | 8 ++++---- cmake/QtTargetHelpers.cmake | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cmake/QtResourceHelpers.cmake b/cmake/QtResourceHelpers.cmake index 9ad9c682b83..6b60751ff0d 100644 --- a/cmake/QtResourceHelpers.cmake +++ b/cmake/QtResourceHelpers.cmake @@ -3,10 +3,10 @@ function(qt_internal_add_resource target resourceName) if(NOT TARGET "${target}") - qt_internal_is_in_test_batch(in_batch ${target}) - if(NOT in_batch) - message(FATAL_ERROR "Trying to add resource to a non-existing target \"${target}\".") - endif() + message(FATAL_ERROR "${target} is not a target.") + endif() + qt_internal_is_in_test_batch(in_batch ${target}) + if(in_batch) _qt_internal_test_batch_target_name(target) endif() diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index c5ced2738c2..1beb4e41f72 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -18,10 +18,10 @@ # Skip the specified source files by PRECOMPILE_HEADERS feature. function(qt_internal_extend_target target) if(NOT TARGET "${target}") - qt_internal_is_in_test_batch(in_batch ${target}) - if(NOT in_batch) - message(FATAL_ERROR "Trying to extend a non-existing target \"${target}\".") - endif() + message(FATAL_ERROR "${target} is not a target.") + endif() + qt_internal_is_in_test_batch(in_batch ${target}) + if(in_batch) _qt_internal_test_batch_target_name(target) endif() @@ -1054,11 +1054,11 @@ endfunction() # The function disables one or multiple internal global definitions that are defined by the # qt_internal_add_global_definition function for a specific 'target'. function(qt_internal_undefine_global_definition target) - if(NOT TARGET ${target}) - qt_internal_is_in_test_batch(in_batch ${target}) - if(NOT ${in_batch}) - message(FATAL_ERROR "${target} is not a target.") - endif() + if(NOT TARGET "${target}") + message(FATAL_ERROR "${target} is not a target.") + endif() + qt_internal_is_in_test_batch(in_batch ${target}) + if(in_batch) _qt_internal_test_batch_target_name(target) endif()