From 928e79cf5d51a3c78d388b7eb972b3dae1ebbb68 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 21 Mar 2016 22:24:56 +0100 Subject: Fix _ecm_update_iconcache to only update the install location Use the CMAKE_INSTALL_PREFIX to ensure that only a file in the install location will be touched. Otherwise a user running make install as root would create root-owned files in the build directory. Use the cmake -E touch command to update the mtime of the directory. That command exists since late 2007, but this manual file creation workaround pre-dates that by a few months (kdelibs SVN revision 691973). There is no chance any calling code is already passing an absolute path here because later in the function it is already used together with a CMAKE_INSTALL_PREFIX. Inspired-by: REVIEW 127445 --- modules/ECMInstallIcons.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/ECMInstallIcons.cmake b/modules/ECMInstallIcons.cmake index 3923636a..730bde7a 100644 --- a/modules/ECMInstallIcons.cmake +++ b/modules/ECMInstallIcons.cmake @@ -206,8 +206,7 @@ function(_ecm_update_iconcache installdir theme) install(CODE " set(DESTDIR_VALUE \"\$ENV{DESTDIR}\") if (NOT DESTDIR_VALUE) - file(WRITE \"${installdir}/${theme}/temp.txt\" \"update\") - file(REMOVE \"${installdir}/${theme}/temp.txt\") + execute_process(COMMAND \"${CMAKE_COMMAND}\" -E touch \"${CMAKE_INSTALL_PREFIX}/${installdir}/${theme}\") 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}\") -- cgit v1.2.1