From 945d9047e6570503485313a1091c52bf5d4a4795 Mon Sep 17 00:00:00 2001 From: Fedor Chelnokov Date: Tue, 20 Oct 2026 20:56:46 +0300 Subject: [PATCH] mr_add_resources: define the icon folder regex inside the function MR_ICON_FOLDERS_REGEX was set at the file scope of ResourceHelpers.cmake, so it was visible only in the directory that included the module. A project calling mr_add_resources from another directory got an empty regex, and REGEX "" EXCLUDE dropped every resource file from the copy and the install. Co-Authored-By: Claude Opus 5.5 --- cmake/Modules/ResourceHelpers.cmake | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/cmake/Modules/ResourceHelpers.cmake b/cmake/Modules/ResourceHelpers.cmake index 0d3b51a926c2..fa9ec70818ca 100644 --- a/cmake/Modules/ResourceHelpers.cmake +++ b/cmake/Modules/ResourceHelpers.cmake @@ -1,19 +1,15 @@ -# The icon folders of a resource directory (icons, object_icons, independent_icons, logos) are packed into -# resource/icons-.zip in the output directory, which MR::RibbonIcons reads on start instead of -# a thousand small files; the other resources are copied as files. -set(MR_ICON_FOLDERS_REGEX "/(icons|object_icons|independent_icons|logos)$") - # copies the resource directory of a target to the output directory and installs it, -# with the icon folders packed into resource/icons-.zip +# with the icon folders packed into resource/icons-.zip, which MR::RibbonIcons reads on start function(mr_add_resources TARGET_NAME) + set(ICON_FOLDERS_REGEX "/(icons|object_icons|independent_icons|logos)$") set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/resource") if(EMSCRIPTEN) set(DST_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/assets") else() set(DST_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") endif() - file(COPY "${SRC_DIR}" DESTINATION "${DST_DIR}" REGEX "${MR_ICON_FOLDERS_REGEX}" EXCLUDE) - install(DIRECTORY "${SRC_DIR}" DESTINATION "${MR_RESOURCES_DIR}" REGEX "${MR_ICON_FOLDERS_REGEX}" EXCLUDE) + file(COPY "${SRC_DIR}" DESTINATION "${DST_DIR}" REGEX "${ICON_FOLDERS_REGEX}" EXCLUDE) + install(DIRECTORY "${SRC_DIR}" DESTINATION "${MR_RESOURCES_DIR}" REGEX "${ICON_FOLDERS_REGEX}" EXCLUDE) file(GLOB_RECURSE ICON_FILES CONFIGURE_DEPENDS "${SRC_DIR}/icons/*.png"