aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Krause <vkrause@kde.org>2015-09-12 14:20:25 +0200
committerVolker Krause <vkrause@kde.org>2015-10-03 11:48:31 +0200
commit12908eafb494ed32a96a5573f0446cc1528265ca (patch)
tree89dfd1daba270ab014b2cc2b726664eb72bb13a4
parent3b20ef911eb83b7bd37315ace682e0e6bc6195d9 (diff)
downloadextra-cmake-modules-12908eafb494ed32a96a5573f0446cc1528265ca.tar.gz
extra-cmake-modules-12908eafb494ed32a96a5573f0446cc1528265ca.tar.bz2
Update GTK icon cache when installing icons.v5.15.0-rc1v5.15.0
Despite the name, Qt is also using this, and it considerably speeds up icon lookup. REVIEW: 125192
-rw-r--r--modules/ECMInstallIcons.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/ECMInstallIcons.cmake b/modules/ECMInstallIcons.cmake
index 79dc5150..920c9490 100644
--- a/modules/ECMInstallIcons.cmake
+++ b/modules/ECMInstallIcons.cmake
@@ -186,7 +186,9 @@ endmacro()
# Updates the mtime of the icon theme directory, so caches that
# watch for changes to the directory will know to update.
+# If present, this also runs gtk-update-icon-cache (which despite the name is also used by Qt).
function(_ecm_update_iconcache installdir theme)
+ find_program(GTK_UPDATE_ICON_CACHE_EXECUTABLE NAMES gtk-update-icon-cache)
# We don't always have touch command (e.g. on Windows), so instead
# create and delete a temporary file in the theme dir.
install(CODE "
@@ -194,6 +196,10 @@ function(_ecm_update_iconcache installdir theme)
if (NOT DESTDIR_VALUE)
file(WRITE \"${installdir}/${theme}/temp.txt\" \"update\")
file(REMOVE \"${installdir}/${theme}/temp.txt\")
+ set(HAVE_GTK_UPDATE_ICON_CACHE_EXEC ${GTK_UPDATE_ICON_CACHE_EXECUTABLE})
+ if (HAVE_GTK_UPDATE_ICON_CACHE_EXEC)
+ execute_process(COMMAND ${GTK_UPDATE_ICON_CACHE_EXECUTABLE} -q -t -i . WORKING_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/${installdir}/${theme}\")
+ endif ()
endif (NOT DESTDIR_VALUE)
")
endfunction()