diff --git a/CMakeLists.txt b/CMakeLists.txt index eea23946..883141ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,18 @@ set(RELEASE_NAME "Lightweight email client for GNOME.") set(VERSION "0.0.0+trunk") set(VERSION_INFO "Release") +option(ICON_UPDATE "Run gtk-update-icon-cache after the install." ON) +option(DESKTOP_UPDATE "Run update-desktop-database after the install." ON) + +if (ICON_UPDATE) + message(STATUS "Icon cache will be updated") +endif () + +if (DESKTOP_UPDATE) + message(STATUS "Desktop database will be updated") +endif () + + add_subdirectory(src) add_subdirectory(icons) add_subdirectory(sql) @@ -33,12 +45,6 @@ install( DESTINATION share/applications ) -install( - CODE - "execute_process (COMMAND update-desktop-database)" - CODE - "execute_process (COMMAND gtk-update-icon-cache -t -f ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor)" -) # # Uninstall target @@ -55,9 +61,23 @@ add_custom_target( ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake COMMAND ${glib_schema_compiler} ${GSETTINGS_DIR} - COMMAND - update-desktop-database - COMMAND - gtk-update-icon-cache -t -f ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor ) +# Optional: run update-desktop-database at install time. +if (DESKTOP_UPDATE) + install( + CODE + "execute_process (COMMAND update-desktop-database)" + CODE + "message (STATUS \"Updating desktop database\")" + ) + + add_custom_target( + uninstall-desktop-update + DEPENDS + uninstall + COMMAND + update-desktop-database + ) +endif () + diff --git a/configure b/configure index 3dca2e47..5cea8d59 100755 --- a/configure +++ b/configure @@ -20,6 +20,15 @@ configure_help() { printf "\t--prefix=PREFIX\t\tPrepend PREFIX to program installation paths.\n" printf "\t\t\t\t[%s]\n" $DEFAULT_PREFIX + printf "\t--disable-schemas-compile\n" + printf "\t\t\t\tDisable compiling the GSettings schema.\n" + + printf "\t--disable-desktop-update\n" + printf "\t\t\t\tDisable desktop database update.\n" + + printf "\t--disable-icon-update\n" + printf "\t\t\t\tDisable icon cache update.\n" + printf "\n" } @@ -47,7 +56,20 @@ do abort $1 fi - CMDLINE="${CMDLINE}-DCMAKE_INSTALL_PREFIX=${value} " + CMDLINE="${CMDLINE} -DCMAKE_INSTALL_PREFIX=${value}" + ;; + + --disable-schemas-compile) + CMDLINE="${CMDLINE} -DGSETTINGS_COMPILE=OFF" + CMDLINE="${CMDLINE} -DGSETTINGS_COMPILE_IN_PLACE=OFF" + ;; + + --disable-icon-update) + CMDLINE="${CMDLINE} -DICON_UPDATE=OFF" + ;; + + --disable-desktop-update) + CMDLINE="${CMDLINE} -DDESKTOP_UPDATE=OFF" ;; *) abort $option diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt index c924093a..3b2bb6a8 100644 --- a/icons/CMakeLists.txt +++ b/icons/CMakeLists.txt @@ -16,3 +16,22 @@ set(ICON_FILES install(FILES ${ICON_FILES} DESTINATION ${ICONS_DEST}) install(FILES geary.png DESTINATION share/icons/hicolor/scalable/apps) + +# Optional: update icon cache at install time. +if (ICON_UPDATE) + install( + CODE + "execute_process (COMMAND gtk-update-icon-cache -t -f ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor)" + CODE + "message (STATUS \"Updating icon cache\")" + ) + + add_custom_target( + uninstall-icon-cache + DEPENDS + uninstall + COMMAND + gtk-update-icon-cache -t -f ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor + ) +endif () +