Skip to content

Commit

Permalink
[CMake] Implement install/uninstall targets
Browse files Browse the repository at this point in the history
  • Loading branch information
luspi committed Jun 15, 2015
1 parent 725f3bc commit 8577f2c
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 0 deletions.
27 changes: 27 additions & 0 deletions CMake/cmake_uninstall.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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")

cmake_policy(SET CMP0007 NEW)

file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
list(REVERSE files)
foreach (file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if (EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif (NOT ${rm_retval} EQUAL 0)
else (EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif (EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)

find_program(XDG xdg-desktop-menu)
execute_process(COMMAND ${XDG} uninstall photoqt.desktop)
53 changes: 53 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,57 @@ ELSEIF(NOT GM)
ENDIF(GM)


#######################
#### INSTALL FILES ####
#######################

IF(UNIX)

# Set the install prefix to /usr/
SET(PRODUCT_INSTALL_PREFIX /usr)

# Install executeable
INSTALL(
TARGETS photoqt
DESTINATION bin/
)

# Install desktop file
INSTALL(
FILES photoqt.desktop
DESTINATION share/applications
)

# And install all the icons
INSTALL(
FILES icons/16x16/apps/photoqt.png
DESTINATION share/icons/hicolor/16x16/apps/
)
INSTALL(
FILES icons/32x32/apps/photoqt.png
DESTINATION share/icons/hicolor/32x32/apps/
)
INSTALL(
FILES icons/48x48/apps/photoqt.png
DESTINATION share/icons/hicolor/48x48/apps/
)
INSTALL(
FILES icons/64x64/apps/photoqt.png
DESTINATION share/icons/hicolor/64x64/apps/
)
INSTALL(
FILES icons/128x128/apps/photoqt.png
DESTINATION share/icons/hicolor/128x128/apps/
)
ENDIF(UNIX)



##########################
#### UNINSTALL TARGET ####
##########################

CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)


Binary file added icons/128x128/apps/photoqt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/16x16/apps/photoqt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/32x32/apps/photoqt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/48x48/apps/photoqt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/64x64/apps/photoqt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8577f2c

Please sign in to comment.