Simplify icon installation (#114)

Uses a foreach loop to iterate over the possible sizes. Should help in the future if more are added.
This commit is contained in:
Nicola Smaniotto 2021-12-26 11:43:47 +01:00 committed by GitHub
parent a6e2a433c4
commit 5ffbab8208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -223,14 +223,8 @@ if(UNIX AND NOT APPLE)
install(TARGETS "${PROJECT_NAME}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") install(TARGETS "${PROJECT_NAME}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES "/Platform/Linux/${PROJECT_NAME}.desktop" DESTINATION "share/applications") install(FILES "/Platform/Linux/${PROJECT_NAME}.desktop" DESTINATION "share/applications")
install(FILES "/Platform/Linux/${PROJECT_NAME}.metainfo.xml" DESTINATION "share/metainfo") install(FILES "/Platform/Linux/${PROJECT_NAME}.metainfo.xml" DESTINATION "share/metainfo")
install(FILES "${PROJECT_NAME}/Icon_16x16.png" DESTINATION foreach(S 16 32 48 128 192)
"share/icons/hicolor/16x16/apps" RENAME "${PROJECT_NAME}.png") install(FILES "${PROJECT_NAME}/Icon_${S}x${S}.png" DESTINATION
install(FILES "${PROJECT_NAME}/Icon_32x32.png" DESTINATION "share/icons/hicolor/${S}x${S}/apps" RENAME "${PROJECT_NAME}.png")
"share/icons/hicolor/32x32/apps" RENAME "${PROJECT_NAME}.png") endforeach(S)
install(FILES "${PROJECT_NAME}/Icon_48x48.png" DESTINATION
"share/icons/hicolor/48x48/apps" RENAME "${PROJECT_NAME}.png")
install(FILES "${PROJECT_NAME}/Icon_128x128.png" DESTINATION
"share/icons/hicolor/128x128/apps" RENAME "${PROJECT_NAME}.png")
install(FILES "${PROJECT_NAME}/Icon_192x192.png" DESTINATION
"share/icons/hicolor/192x192/apps" RENAME "${PROJECT_NAME}.png")
endif() endif()