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 Pick-to: 6.2 Change-Id: I291775813f025cabdccd4372ac077cdfd3ec090e Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
a37789e493
commit
f68f6ecf6f
@ -355,7 +355,12 @@ if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
|||||||
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
|
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
|
||||||
qt6_add_resources("${outfiles}" ${ARGN})
|
qt6_add_resources("${outfiles}" ${ARGN})
|
||||||
endif()
|
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)
|
set("${outfiles}" "${${outfiles}}" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
@ -667,6 +672,8 @@ function(_qt_internal_find_ios_development_team_id out_var)
|
|||||||
string(STRIP "${team_id}" team_id)
|
string(STRIP "${team_id}" team_id)
|
||||||
set_property(GLOBAL PROPERTY _qt_internal_ios_development_team_id "${team_id}")
|
set_property(GLOBAL PROPERTY _qt_internal_ios_development_team_id "${team_id}")
|
||||||
set("${out_var}" "${team_id}" PARENT_SCOPE)
|
set("${out_var}" "${team_id}" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set("${out_var}" "" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@ -704,6 +711,8 @@ function(_qt_internal_get_ios_bundle_identifier_prefix out_var)
|
|||||||
if(prefix AND NOT prefix_error)
|
if(prefix AND NOT prefix_error)
|
||||||
set_property(GLOBAL PROPERTY _qt_internal_ios_bundle_identifier_prefix "${prefix}")
|
set_property(GLOBAL PROPERTY _qt_internal_ios_bundle_identifier_prefix "${prefix}")
|
||||||
set("${out_var}" "${prefix}" PARENT_SCOPE)
|
set("${out_var}" "${prefix}" PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set("${out_var}" "" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
@ -1195,7 +1204,7 @@ function(qt6_extract_metatypes target)
|
|||||||
target_sources(${target} INTERFACE ${metatypes_file_genex_build})
|
target_sources(${target} INTERFACE ${metatypes_file_genex_build})
|
||||||
|
|
||||||
if(arg_OUTPUT_FILES)
|
if(arg_OUTPUT_FILES)
|
||||||
set(${arg_OUTPUT_FILES} "${metatypes_file}")
|
set(${arg_OUTPUT_FILES} "${metatypes_file}" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Chech whether the generated json file needs to be installed.
|
# Chech whether the generated json file needs to be installed.
|
||||||
@ -1234,6 +1243,10 @@ endfunction()
|
|||||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||||
function(qt_extract_metatypes)
|
function(qt_extract_metatypes)
|
||||||
qt6_extract_metatypes(${ARGV})
|
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()
|
endfunction()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -1816,6 +1829,9 @@ function(_qt_internal_process_resource target resourceName)
|
|||||||
if(isBinary)
|
if(isBinary)
|
||||||
# Add generated .rcc target to 'all' set
|
# Add generated .rcc target to 'all' set
|
||||||
add_custom_target(binary_resource_${generatedBaseName} ALL DEPENDS "${generatedOutfile}")
|
add_custom_target(binary_resource_${generatedBaseName} ALL DEPENDS "${generatedOutfile}")
|
||||||
|
if(rcc_OUTPUT_TARGETS)
|
||||||
|
set(${rcc_OUTPUT_TARGETS} "" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set_property(SOURCE "${generatedOutfile}" PROPERTY SKIP_AUTOGEN ON)
|
set_property(SOURCE "${generatedOutfile}" PROPERTY SKIP_AUTOGEN ON)
|
||||||
set_property(TARGET ${target} APPEND PROPERTY _qt_generated_qrc_files "${generatedResourceFile}")
|
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)
|
if(NOT arg___QT_INTERNAL_NO_PROPAGATE_PLUGIN_INITIALIZER)
|
||||||
__qt_internal_propagate_object_library("${target}" "${plugin_init_target}")
|
__qt_internal_propagate_object_library("${target}" "${plugin_init_target}")
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
if(arg_OUTPUT_TARGETS)
|
||||||
|
set(${arg_OUTPUT_TARGETS} "" PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(${target} PRIVATE
|
target_compile_definitions(${target} PRIVATE
|
||||||
@ -1982,6 +2002,10 @@ endfunction()
|
|||||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||||
function(qt_add_plugin)
|
function(qt_add_plugin)
|
||||||
qt6_add_plugin(${ARGV})
|
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()
|
endfunction()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user