summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-09-06 11:18:06 +1000
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-09-06 13:56:45 +0000
commit059dcbea2a3f3583c8dfeb14589d429d6799cfa8 (patch)
tree2153348d5106e793c39f621d7fd6c3b679134636
parentdaf64298ca6cae1243b7756d3b82ea24cbfee9cd (diff)
Fix cases of output variables not being passed back to calling scope
Some versionless wrappers were not passing back output variables to their calling scope. Ensure they always are. Fix qt6_extract_metatypes() to set its output variable in the parent scope (it was previously setting it erroneously in the local scope). Some functions had code paths that would not set output variables. This would allow situations where if the variables had an initial value set by a higher up parent scope, the output variable would still have that value in the caller's scope upon return. That could be misleading, so fix these code paths to explicitly set the output variable to an empty string instead. Task-number: QTBUG-96121 Task-number: QTBUG-96219 Change-Id: I291775813f025cabdccd4372ac077cdfd3ec090e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit f68f6ecf6f2c6c0567c3255568446700cb1f952c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/corelib/Qt6CoreMacros.cmake28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index 80d2d4cf4d..aebff888db 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()