summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2024-11-28 21:23:34 +0100
committerxengineering <me@xengineering.eu>2024-11-28 21:33:32 +0100
commit5349c8967f4ca96e4367fdc3e147f33ca44c52f9 (patch)
tree309010e11217cb057347485f6d780e6a86f8aa71
parent03a876c1e9f2caeff34812e40f1174a89b9b96e1 (diff)
downloadgraphics-inkscape-5349c8967f4ca96e4367fdc3e147f33ca44c52f9.tar
graphics-inkscape-5349c8967f4ca96e4367fdc3e147f33ca44c52f9.tar.zst
graphics-inkscape-5349c8967f4ca96e4367fdc3e147f33ca44c52f9.zip
icons: Use globbing to auto-register icons to CMake
Adding new icons now only requires adding an SVG file to the icons directory. The icon name does not have to be added to the CMakeLists.txt file.
-rw-r--r--CMakeLists.txt7
1 files changed, 3 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a72749..797128f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,9 +2,7 @@ cmake_minimum_required(VERSION 3.10)
project(art-inkscape LANGUAGES NONE)
-set(icons
- example
-)
+file(GLOB icon_files "${CMAKE_CURRENT_SOURCE_DIR}/icons/*.svg")
set(formats
pdf
@@ -15,7 +13,8 @@ set(formats
find_program(imagemagick magick convert)
-foreach(icon ${icons})
+foreach(icon_file ${icon_files})
+ get_filename_component(icon ${icon_file} NAME_WE)
foreach(format ${formats})
set(source "${CMAKE_CURRENT_SOURCE_DIR}/icons/${icon}.svg")
set(sink "${CMAKE_CURRENT_BINARY_DIR}/icons/${format}/${icon}.${format}")