diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index fc12bd210d..2164ee21ab 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -355,7 +355,12 @@ if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6) qt6_add_resources("${outfiles}" ${ARGN}) endif() - if(NOT TARGET ${outfiles}) + if(TARGET ${outfiles}) + cmake_parse_arguments(PARSE_ARGV 1 arg "" "OUTPUT_TARGETS" "") + if (arg_OUTPUT_TARGETS) + set(${arg_OUTPUT_TARGETS} ${${arg_OUTPUT_TARGETS}} PARENT_SCOPE) + endif() + else() set("${outfiles}" "${${outfiles}}" PARENT_SCOPE) endif() endfunction() @@ -667,6 +672,8 @@ function(_qt_internal_find_ios_development_team_id out_var) string(STRIP "${team_id}" team_id) set_property(GLOBAL PROPERTY _qt_internal_ios_development_team_id "${team_id}") set("${out_var}" "${team_id}" PARENT_SCOPE) + else() + set("${out_var}" "" PARENT_SCOPE) endif() endfunction() @@ -704,6 +711,8 @@ function(_qt_internal_get_ios_bundle_identifier_prefix out_var) if(prefix AND NOT prefix_error) set_property(GLOBAL PROPERTY _qt_internal_ios_bundle_identifier_prefix "${prefix}") set("${out_var}" "${prefix}" PARENT_SCOPE) + else() + set("${out_var}" "" PARENT_SCOPE) endif() endfunction() @@ -1195,7 +1204,7 @@ function(qt6_extract_metatypes target) target_sources(${target} INTERFACE ${metatypes_file_genex_build}) if(arg_OUTPUT_FILES) - set(${arg_OUTPUT_FILES} "${metatypes_file}") + set(${arg_OUTPUT_FILES} "${metatypes_file}" PARENT_SCOPE) endif() # Chech whether the generated json file needs to be installed. @@ -1234,6 +1243,10 @@ endfunction() if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) function(qt_extract_metatypes) qt6_extract_metatypes(${ARGV}) + cmake_parse_arguments(PARSE_ARGV 0 arg "" "OUTPUT_FILES" "") + if(arg_OUTPUT_FILES) + set(${arg_OUTPUT_FILES} "${${arg_OUTPUT_FILES}}" PARENT_SCOPE) + endif() endfunction() endif() @@ -1816,6 +1829,9 @@ function(_qt_internal_process_resource target resourceName) if(isBinary) # Add generated .rcc target to 'all' set add_custom_target(binary_resource_${generatedBaseName} ALL DEPENDS "${generatedOutfile}") + if(rcc_OUTPUT_TARGETS) + set(${rcc_OUTPUT_TARGETS} "" PARENT_SCOPE) + endif() else() set_property(SOURCE "${generatedOutfile}" PROPERTY SKIP_AUTOGEN ON) set_property(TARGET ${target} APPEND PROPERTY _qt_generated_qrc_files "${generatedResourceFile}") @@ -1971,6 +1987,10 @@ function(qt6_add_plugin target) if(NOT arg___QT_INTERNAL_NO_PROPAGATE_PLUGIN_INITIALIZER) __qt_internal_propagate_object_library("${target}" "${plugin_init_target}") endif() + else() + if(arg_OUTPUT_TARGETS) + set(${arg_OUTPUT_TARGETS} "" PARENT_SCOPE) + endif() endif() target_compile_definitions(${target} PRIVATE @@ -1982,6 +2002,10 @@ endfunction() if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS) function(qt_add_plugin) qt6_add_plugin(${ARGV}) + cmake_parse_arguments(PARSE_ARGV 1 arg "" "OUTPUT_TARGETS" "") + if(arg_OUTPUT_TARGETS) + set(${arg_OUTPUT_TARGETS} ${${arg_OUTPUT_TARGETS}} PARENT_SCOPE) + endif() endfunction() endif()