From 5349c8967f4ca96e4367fdc3e147f33ca44c52f9 Mon Sep 17 00:00:00 2001 From: xengineering Date: Thu, 28 Nov 2024 21:23:34 +0100 Subject: 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. --- CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'CMakeLists.txt') 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}") -- cgit v1.2.3-70-g09d2