Support multiple equally named .qrc files in qt_add_big_resources
It is now possible to call qt_add_big_resources with multiple .qrc files that are in different directories but have the same file name. Before, this resulted in target name conflict errors. Pick-to: 6.1 Fixes: QTBUG-93230 Change-Id: Ic3d9d6974a107163aeb7ada0b6f1fa113fb18de0 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
ecbf6c5b00
commit
895edcd7cd
@ -384,6 +384,19 @@ function(qt6_add_big_resources outfiles )
|
||||
|
||||
foreach(it ${rcc_files})
|
||||
get_filename_component(outfilename ${it} NAME_WE)
|
||||
|
||||
# Provide unique targets and output file names
|
||||
# in case we add multiple .qrc files with the same base name.
|
||||
string(MAKE_C_IDENTIFIER "_qt_big_resource_count_${outfilename}" prop)
|
||||
get_property(count GLOBAL PROPERTY ${prop})
|
||||
if(count)
|
||||
string(APPEND outfilename "_${count}")
|
||||
else()
|
||||
set(count 0)
|
||||
endif()
|
||||
math(EXPR count "${count} + 1")
|
||||
set_property(GLOBAL PROPERTY ${prop} ${count})
|
||||
|
||||
get_filename_component(infile ${it} ABSOLUTE)
|
||||
set(tmpoutfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}tmp.cpp)
|
||||
set(outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${outfilename}.o)
|
||||
|
@ -9,7 +9,8 @@ find_package(Qt6Core REQUIRED)
|
||||
|
||||
qt_wrap_cpp(moc_files myobject.h)
|
||||
|
||||
qt_add_big_resources(rcc_files "test_add_big_resource.qrc" "test_add_big_resource2.qrc")
|
||||
qt_add_big_resources(rcc_files "test_add_big_resource.qrc" "test_add_big_resource2.qrc"
|
||||
"subdir/test_add_big_resource.qrc")
|
||||
|
||||
add_executable(myobject myobject.cpp ${moc_files} ${rcc_files})
|
||||
target_link_libraries(myobject PRIVATE Qt::Core)
|
||||
|
@ -0,0 +1 @@
|
||||
Ken sent me.
|
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/">
|
||||
<file>subdir_resource_file.txt</file>
|
||||
</qresource>
|
||||
</RCC>
|
Loading…
Reference in New Issue
Block a user