Fix OUTPUT_TARGET propagation in qt6_add_resource()
Value was not being propagated to the parent scope when set. This patch also changes OUTPUT_TARGET to OUTPUT_TARGETS since it is possible that two targets can be generated. Change-Id: If489a609ed363a319224fcd6c5a4fc878d0d8617 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
This commit is contained in:
parent
5884f793b9
commit
21dd3624a5
@ -2005,14 +2005,16 @@ function(add_qt_resource target resourceName)
|
||||
LANG "${arg_LANG}"
|
||||
BASE "${arg_BASE}"
|
||||
FILES ${arg_FILES}
|
||||
OUTPUT_TARGET out_target
|
||||
OUTPUT_TARGETS out_targets
|
||||
)
|
||||
|
||||
if (out_target)
|
||||
qt_install(TARGETS "${out_target}"
|
||||
EXPORT "${INSTALL_CMAKE_NAMESPACE}${target}Targets"
|
||||
DESTINATION ${INSTALL_LIBDIR}
|
||||
)
|
||||
if (out_targets)
|
||||
foreach(out_target IN LISTS out_targets)
|
||||
qt_install(TARGETS "${out_target}"
|
||||
EXPORT "${INSTALL_CMAKE_NAMESPACE}${target}Targets"
|
||||
DESTINATION ${INSTALL_LIBDIR}
|
||||
)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
|
@ -180,17 +180,18 @@ endfunction()
|
||||
# Alias settings for files need to be set via the QT_RESOURCE_ALIAS property
|
||||
# via the set_soure_files_properties() command.
|
||||
#
|
||||
# When using this command with static libraries, a special target will be
|
||||
# generated. Should you wish to perform additional processing on said target
|
||||
# pass a value to the OUTPUT_TARGET parameter.
|
||||
# When using this command with static libraries, one or more special targets
|
||||
# will be generated. Should you wish to perform additional processing on these
|
||||
# targets pass a value to the OUTPUT_TARGETS parameter.
|
||||
#
|
||||
function(QT@PROJECT_VERSION_MAJOR@_PROCESS_RESOURCE target resourceName)
|
||||
|
||||
cmake_parse_arguments(rcc "" "PREFIX;LANG;BASE;OUTPUT_TARGET" "FILES" ${ARGN})
|
||||
cmake_parse_arguments(rcc "" "PREFIX;LANG;BASE;OUTPUT_TARGETS" "FILES" ${ARGN})
|
||||
|
||||
string(REPLACE "/" "_" resourceName ${resourceName})
|
||||
string(REPLACE "." "_" resourceName ${resourceName})
|
||||
|
||||
set(output_targets "")
|
||||
# Apply base to all files
|
||||
if (rcc_BASE)
|
||||
foreach(file IN LISTS rcc_FILES)
|
||||
@ -227,11 +228,12 @@ function(QT@PROJECT_VERSION_MAJOR@_PROCESS_RESOURCE target resourceName)
|
||||
)
|
||||
|
||||
if (NOT resources)
|
||||
if (rcc_OUTPUT_TARGET)
|
||||
set(${rcc_OUTPUT_TARGET} "${output_target}" PARENT_SCOPE)
|
||||
if (rcc_OUTPUT_TARGETS)
|
||||
set(${rcc_OUTPUT_TARGETS} "${output_target}" PARENT_SCOPE)
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
list(APPEND output_targets ${output_target})
|
||||
set(generatedResourceFile "${CMAKE_CURRENT_BINARY_DIR}/generated_${newResourceName}.qrc")
|
||||
set(generatedSourceCode "${CMAKE_CURRENT_BINARY_DIR}/qrc_${newResourceName}.cpp")
|
||||
|
||||
@ -281,10 +283,11 @@ function(QT@PROJECT_VERSION_MAJOR@_PROCESS_RESOURCE target resourceName)
|
||||
# qml cache loader
|
||||
if(newResourceName STREQUAL resourceName)
|
||||
__qt_propagate_generated_resource(${target} ${resourceName} "${generatedSourceCode}" output_target)
|
||||
list(APPEND output_targets ${output_target})
|
||||
else()
|
||||
target_sources(${target} PRIVATE "${generatedSourceCode}")
|
||||
endif()
|
||||
if (rcc_OUTPUT_TARGET)
|
||||
set(${rcc_OUTPUT_TARGET} "${output_target}" PARENT_SCOPE)
|
||||
if (rcc_OUTPUT_TARGETS)
|
||||
set(${rcc_OUTPUT_TARGETS} "${output_targets}" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
@ -262,7 +262,11 @@ endfunction()
|
||||
|
||||
function(QT6_ADD_RESOURCES outfiles )
|
||||
if (TARGET ${outfiles})
|
||||
cmake_parse_arguments(arg "" "OUTPUT_TARGETS" "" ${ARGN})
|
||||
QT6_PROCESS_RESOURCE(${ARGV})
|
||||
if (arg_OUTPUT_TARGETS)
|
||||
set(${arg_OUTPUT_TARGETS} ${${arg_OUTPUT_TARGETS}} PARENT_SCOPE)
|
||||
endif()
|
||||
else()
|
||||
set(options)
|
||||
set(oneValueArgs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user