Changeset - 2ac47c7bb726
[Not reviewed]
default
0 1 1
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-05-07 15:31:25
hy@ozderya.net
added `make uninstall` target
2 files changed with 32 insertions and 0 deletions:
0 comments (0 inline, 0 general)
CMakeLists.txt
Show inline comments
 
@@ -92,12 +92,23 @@ install(FILES
 

	
 
install(CODE "
 
  execute_process(COMMAND ${XDG-DESKTOP-MENU} install --novendor ${CMAKE_INSTALL_PREFIX}/share/serialplot/serialplot.desktop)
 
  execute_process(COMMAND ${XDG-ICON-RESOURCE} install --novendor --size 256 ${CMAKE_INSTALL_PREFIX}/share/serialplot/serialplot.png)
 
")
 

	
 
# uninstalling
 
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
 
  COMMAND ${XDG-DESKTOP-MENU} uninstall --novendor serialplot.desktop
 
  COMMAND ${XDG-ICON-RESOURCE} uninstall --novendor --size 256 serialplot)
 

	
 
# packaging
 
set(CPACK_GENERATOR "DEB")
 

	
 
include(InstallRequiredSystemLibraries)
 

	
 
set(CPACK_PACKAGE_NAME "serialplot")
cmake/cmake_uninstall.cmake.in
Show inline comments
 
new file 100644
 
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 $ENV{DESTDIR}${file}")
 
  if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
 
    exec_program(
 
      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
 
      OUTPUT_VARIABLE rm_out
 
      RETURN_VALUE rm_retval
 
      )
 
    if(NOT "${rm_retval}" STREQUAL 0)
 
      message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
 
    endif(NOT "${rm_retval}" STREQUAL 0)
 
  else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
 
    message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
 
  endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
 
endforeach(file)
 
\ No newline at end of file
0 comments (0 inline, 0 general)