aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2022-05-11 10:00:01 +0200
committerPierre Ossman <ossman@cendio.se>2022-05-11 13:05:47 +0200
commit379ad8218842622b9a277eaa98dc36a6f49e1830 (patch)
treef110c9fd03df07818d7b050335c21a7f4077692a
parent28fcd03d7b728c07254ec7c10a4be5d543ef37ec (diff)
downloadtigervnc-379ad8218842622b9a277eaa98dc36a6f49e1830.tar.gz
tigervnc-379ad8218842622b9a277eaa98dc36a6f49e1830.zip
Avoid duplicating list of icon sizes
-rw-r--r--media/CMakeLists.txt54
1 files changed, 13 insertions, 41 deletions
diff --git a/media/CMakeLists.txt b/media/CMakeLists.txt
index e6eb1a17..487e9d00 100644
--- a/media/CMakeLists.txt
+++ b/media/CMakeLists.txt
@@ -1,47 +1,19 @@
-set(ICON_FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_16.png
- ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_22.png
- ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_24.png
- ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_32.png
- ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_48.png)
+set(ICON_SIZES 16 22 24 32 48)
find_program(CONVERT_EXECUTABLE convert)
if(CONVERT_EXECUTABLE)
+ foreach(SIZE ${ICON_SIZES})
+ list(APPEND ICON_FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_${SIZE}.png)
+ endforeach()
add_custom_target(icons DEPENDS ${ICON_FILES})
-endif()
-
-add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_16.png
- COMMAND ${CONVERT_EXECUTABLE} -depth 8 -background transparent
- ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_16.svg
- ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_16.png
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_16.svg
- COMMENT "Generating icons/tigervnc_16.png")
-
-add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_22.png
- COMMAND ${CONVERT_EXECUTABLE} -depth 8 -background transparent
- ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_22.svg
- ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_22.png
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_22.svg
- COMMENT "Generating icons/tigervnc_22.png")
-add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_24.png
- COMMAND ${CONVERT_EXECUTABLE} -depth 8 -background transparent
- ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_24.svg
- ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_24.png
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_24.svg
- COMMENT "Generating icons/tigervnc_24.png")
-
-add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_32.png
- COMMAND ${CONVERT_EXECUTABLE} -depth 8 -background transparent
- ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_32.svg
- ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_32.png
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_32.svg
- COMMENT "Generating icons/tigervnc_32.png")
-
-add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_48.png
- COMMAND ${CONVERT_EXECUTABLE} -depth 8 -background transparent
- ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_48.svg
- ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_48.png
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_48.svg
- COMMENT "Generating icons/tigervnc_48.png")
+ foreach(SIZE ${ICON_SIZES})
+ add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_${SIZE}.png
+ COMMAND ${CONVERT_EXECUTABLE} -depth 8 -background transparent
+ ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_${SIZE}.svg
+ ${CMAKE_CURRENT_SOURCE_DIR}/icons/tigervnc_${SIZE}.png
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tigervnc_${SIZE}.svg
+ COMMENT "Generating icons/tigervnc_${SIZE}.png")
+ endforeach()
+endif()