CMake: Add FILES_PREFIX argument to qtc_add_resources

In order to support the use-case when the alias should not have the
prefix that the resource file name has.

Change-Id: I5438122e623fd9538ee60c0c518d274da571df84
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Cristian Adam
2025-04-16 12:40:14 +02:00
parent 26faad6725
commit 3a1fb6723c

View File

@@ -1173,7 +1173,7 @@ function(qtc_copy_to_builddir custom_target_name)
endfunction()
function(qtc_add_resources target resourceName)
cmake_parse_arguments(rcc "" "PREFIX;LANG;BASE" "FILES;OPTIONS;CONDITION" ${ARGN})
cmake_parse_arguments(rcc "" "PREFIX;LANG;BASE;FILES_PREFIX" "FILES;OPTIONS;CONDITION" ${ARGN})
if (${_arg_UNPARSED_ARGUMENTS})
message(FATAL_ERROR "qtc_add_resources had unparsed arguments!")
endif()
@@ -1226,8 +1226,12 @@ function(qtc_add_resources target resourceName)
set(file_resource_path ${file})
if (NOT IS_ABSOLUTE ${file})
if (rcc_FILES_PREFIX)
set(file "${CMAKE_CURRENT_SOURCE_DIR}/${rcc_FILES_PREFIX}/${file}")
else()
set(file "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
endif()
endif()
### FIXME: escape file paths to be XML conform
# <file ...>...</file>