diff options
Diffstat (limited to 'cmake/QtTargetHelpers.cmake')
-rw-r--r-- | cmake/QtTargetHelpers.cmake | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index cfeb969ca9..4a51849c78 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -4,15 +4,20 @@ # This function can be used to add sources/libraries/etc. to the specified CMake target # if the provided CONDITION evaluates to true. 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() + qt_internal_test_batch_target_name(target) + endif() + # Don't try to extend_target when cross compiling an imported host target (like a tool). qt_is_imported_target("${target}" is_imported) if(is_imported) return() endif() - if (NOT TARGET "${target}") - message(FATAL_ERROR "Trying to extend non-existing target \"${target}\".") - endif() qt_parse_all_arguments(arg "qt_extend_target" "" "PRECOMPILED_HEADER" "CONDITION;${__default_public_args};${__default_private_args};${__default_private_module_args};COMPILE_FLAGS;NO_PCH_SOURCES" ${ARGN}) if ("x${arg_CONDITION}" STREQUAL x) @@ -884,7 +889,11 @@ endfunction() # qt_internal_add_global_definition function for a specific 'target'. function(qt_internal_undefine_global_definition target) if(NOT TARGET ${target}) - message(FATAL_ERROR "${target} is not a target.") + qt_internal_is_in_test_batch(in_batch ${target}) + if(NOT ${in_batch}) + message(FATAL_ERROR "${target} is not a target.") + endif() + qt_internal_test_batch_target_name(target) endif() if("${ARGN}" STREQUAL "") |