From 35a306b9a711db25aaaca39f5fb538db9b7e8667 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Thu, 4 Mar 2010 16:41:14 +0000 Subject: [PATCH] Install .desktop file and icon. Also add an "uninstall" target. Fixes issue #52 --- CMakeLists.txt | 9 +++++++++ cmake_uninstall.cmake.in | 23 +++++++++++++++++++++++ src/CMakeLists.txt | 12 +++++++++++- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 cmake_uninstall.cmake.in diff --git a/CMakeLists.txt b/CMakeLists.txt index eefcc65f0..d208b3936 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,3 +82,12 @@ add_subdirectory(3rdparty/qxt) add_subdirectory(src) add_subdirectory(tests) + +# Uninstall support +CONFIGURE_FILE( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + +ADD_CUSTOM_TARGET(uninstall + "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in new file mode 100644 index 000000000..290dc7870 --- /dev/null +++ b/cmake_uninstall.cmake.in @@ -0,0 +1,23 @@ +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"${file}\"") + IF(EXISTS "${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF("${rm_retval}" STREQUAL 0) + ELSE("${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"") + ENDIF("${rm_retval}" STREQUAL 0) + ELSE(EXISTS "${file}") + MESSAGE(STATUS "File \"${file}\" does not exist.") + ENDIF(EXISTS "${file}") +ENDFOREACH(file) + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6cc7db003..f017894f4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -229,4 +229,14 @@ set_target_properties(clementine PROPERTIES install(TARGETS clementine BUNDLE DESTINATION bin - RUNTIME DESTINATION bin) + RUNTIME DESTINATION bin +) + +install(FILES ../dist/clementine_64.png + DESTINATION share/icons/hicolor/64x64/apps/ + RENAME application-x-clementine.png +) + +install(FILES ../dist/clementine.desktop + DESTINATION share/applications +)