aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/ECMInstallIcons.cmake9
-rw-r--r--tests/ECMInstallIconsTest/CMakeLists.txt15
-rw-r--r--tests/ECMInstallIconsTest/expected-tree/badly-named-files-test/hicolor/16x16/actions/old-style-name.png (renamed from tests/ECMInstallIconsTest/16-apps-cmake.png)bin233 -> 233 bytes
-rw-r--r--tests/ECMInstallIconsTest/hi16-actions-old-style-name.pngbin0 -> 233 bytes
-rw-r--r--tests/ECMInstallIconsTest/subdir/16-apps-cmake.pngbin0 -> 233 bytes
5 files changed, 16 insertions, 8 deletions
diff --git a/modules/ECMInstallIcons.cmake b/modules/ECMInstallIcons.cmake
index 34d5a485..79dc5150 100644
--- a/modules/ECMInstallIcons.cmake
+++ b/modules/ECMInstallIcons.cmake
@@ -223,8 +223,9 @@ function(ecm_install_icons)
endif()
foreach(icon ${ARG_ICONS})
+ get_filename_component(filename "${icon}" NAME)
string(REGEX MATCH "([0-9sc]+)\\-([a-z]+)\\-([^/]+)\\.([a-z]+)$"
- _dummy "${icon}")
+ complete_match "${filename}")
set(size "${CMAKE_MATCH_1}")
set(group "${CMAKE_MATCH_2}")
set(name "${CMAKE_MATCH_3}")
@@ -234,6 +235,12 @@ function(ecm_install_icons)
elseif(NOT size STREQUAL "sc" AND NOT size GREATER 0)
message(WARNING "${icon} size (${size}) is invalid - ignoring")
else()
+ if (NOT complete_match STREQUAL filename)
+ # We can't stop accepting filenames with leading characters,
+ # because that would break existing projects, so just warn
+ # about them instead.
+ message(AUTHOR_WARNING "\"${icon}\" has characters before the size; it should be renamed to \"${size}-${group}-${name}.${ext}\"")
+ endif()
if(NOT _ECM_ICON_GROUP_${group})
message(WARNING "${icon} group (${group}) is not recognized")
endif()
diff --git a/tests/ECMInstallIconsTest/CMakeLists.txt b/tests/ECMInstallIconsTest/CMakeLists.txt
index 85f2d9f5..7fe4ca35 100644
--- a/tests/ECMInstallIconsTest/CMakeLists.txt
+++ b/tests/ECMInstallIconsTest/CMakeLists.txt
@@ -20,7 +20,7 @@ ecm_install_icons(
ICONS
16-actions-computer.png
16-animations-loading.mng
- 16-apps-cmake.png
+ subdir/16-apps-cmake.png
16-categories-system-help.mng
16-emotes-face-smile.png
16-intl-something.png
@@ -36,7 +36,7 @@ ecm_install_icons(
ICONS
16-actions-computer.png
16-animations-loading.mng
- 16-apps-cmake.png
+ subdir/16-apps-cmake.png
16-categories-system-help.mng
16-emotes-face-smile.png
16-intl-something.png
@@ -53,7 +53,7 @@ ecm_install_icons(
ICONS
16-actions-computer.png
16-animations-loading.mng
- 16-apps-cmake.png
+ subdir/16-apps-cmake.png
16-categories-system-help.mng
16-emotes-face-smile.png
16-intl-something.png
@@ -70,7 +70,7 @@ ecm_install_icons(
ICONS
16-actions-computer.png
16-animations-loading.mng
- 16-apps-cmake.png
+ subdir/16-apps-cmake.png
16-categories-system-help.mng
16-emotes-face-smile.png
16-intl-something.png
@@ -87,9 +87,10 @@ ecm_install_icons(
# all these should be warned about
ecm_install_icons(
ICONS
- aa-actions-badsize.png # ignored
- badlynamedfile.png # ignored
- 16-actions-badext.txt # copied
+ aa-actions-badsize.png # ignored
+ badlynamedfile.png # ignored
+ 16-actions-badext.txt # copied
+ hi16-actions-old-style-name.png # copied
DESTINATION badly-named-files-test
)
diff --git a/tests/ECMInstallIconsTest/16-apps-cmake.png b/tests/ECMInstallIconsTest/expected-tree/badly-named-files-test/hicolor/16x16/actions/old-style-name.png
index ed9a1181..ed9a1181 100644
--- a/tests/ECMInstallIconsTest/16-apps-cmake.png
+++ b/tests/ECMInstallIconsTest/expected-tree/badly-named-files-test/hicolor/16x16/actions/old-style-name.png
Binary files differ
diff --git a/tests/ECMInstallIconsTest/hi16-actions-old-style-name.png b/tests/ECMInstallIconsTest/hi16-actions-old-style-name.png
new file mode 100644
index 00000000..ed9a1181
--- /dev/null
+++ b/tests/ECMInstallIconsTest/hi16-actions-old-style-name.png
Binary files differ
diff --git a/tests/ECMInstallIconsTest/subdir/16-apps-cmake.png b/tests/ECMInstallIconsTest/subdir/16-apps-cmake.png
new file mode 100644
index 00000000..ed9a1181
--- /dev/null
+++ b/tests/ECMInstallIconsTest/subdir/16-apps-cmake.png
Binary files differ