cmake: Support passing extra arguments to rcc

qt6_add_resources already supported the OPTIONS multi value parameter,
but only for the non-target case. Use the same parameter for the target
case.

Change-Id: Ib5fcb976ecbac244c3b11073b3cdd0c5c6366a87
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Reviewed-by: Qt CMake Build Bot
This commit is contained in:
Joerg Bornemann 2019-09-20 10:44:22 +02:00
parent d245ba48e7
commit 2ee974b892

View File

@ -186,7 +186,7 @@ endfunction()
# #
function(QT@PROJECT_VERSION_MAJOR@_PROCESS_RESOURCE target resourceName) function(QT@PROJECT_VERSION_MAJOR@_PROCESS_RESOURCE target resourceName)
cmake_parse_arguments(rcc "" "PREFIX;LANG;BASE;OUTPUT_TARGETS" "FILES" ${ARGN}) cmake_parse_arguments(rcc "" "PREFIX;LANG;BASE;OUTPUT_TARGETS" "FILES;OPTIONS" ${ARGN})
string(REPLACE "/" "_" resourceName ${resourceName}) string(REPLACE "/" "_" resourceName ${resourceName})
string(REPLACE "." "_" resourceName ${resourceName}) string(REPLACE "." "_" resourceName ${resourceName})
@ -268,11 +268,16 @@ function(QT@PROJECT_VERSION_MAJOR@_PROCESS_RESOURCE target resourceName)
file(GENERATE OUTPUT "${generatedResourceFile}" CONTENT "${qrcContents}") file(GENERATE OUTPUT "${generatedResourceFile}" CONTENT "${qrcContents}")
set(rccArgs --name "${newResourceName}"
--output "${generatedSourceCode}" "${generatedResourceFile}")
if(rcc_OPTIONS)
list(APPEND rccArgs ${rcc_OPTIONS})
endif()
# Process .qrc file: # Process .qrc file:
add_custom_command(OUTPUT "${generatedSourceCode}" add_custom_command(OUTPUT "${generatedSourceCode}"
COMMAND "@QT_CMAKE_EXPORT_NAMESPACE@::rcc" COMMAND "@QT_CMAKE_EXPORT_NAMESPACE@::rcc"
ARGS --name "${newResourceName}" ARGS ${rccArgs}
--output "${generatedSourceCode}" "${generatedResourceFile}"
DEPENDS ${resources} ${generatedResourceFile} DEPENDS ${resources} ${generatedResourceFile}
COMMENT "RCC ${newResourceName}" COMMENT "RCC ${newResourceName}"
VERBATIM) VERBATIM)