1############################################################################# 2## Kwave - cmake/uninstall.cmake.in 3## ------------------- 4## begin : Sat May 26 2007 5## copyright : (C) 2007 by Thomas Eschenbacher 6## email : Thomas.Eschenbacher@gmx.de 7## 8## based on : cmake_uninstall.cmake.in from KDE 9## 10############################################################################# 11# 12############################################################################# 13# # 14# Redistribution and use in source and binary forms, with or without # 15# modification, are permitted provided that the following conditions # 16# are met: # 17# # 18# 1. Redistributions of source code must retain the above copyright # 19# notice, this list of conditions and the following disclaimer. # 20# 2. Redistributions in binary form must reproduce the above copyright # 21# notice, this list of conditions and the following disclaimer in the # 22# documentation and/or other materials provided with the distribution. # 23# # 24# For details see the accompanying cmake/COPYING-CMAKE-SCRIPTS file. # 25# # 26############################################################################# 27 28# check if the install_manifest exists 29IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 30 MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 31ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 32 33# read in the install_manifest and convert it into a list 34FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 35STRING(REGEX REPLACE "\n" ";" files "${files}") 36SET(files "${files}$ENV{EXTRA_UNINSTALL_FILES}") 37 38# loop over all files 39FOREACH(_file ${files}) 40 # convert into absolute filename and prepend $DESTDIR 41 GET_FILENAME_COMPONENT(_file ${_file} ABSOLUTE) 42 SET(_file $ENV{DESTDIR}/${_file}) 43 44 # uninstall the file 45 MESSAGE(STATUS "Uninstalling \"${_file}\"") 46 EXEC_PROGRAM( 47 "@CMAKE_COMMAND@" ARGS "-E remove \"${_file}\"" 48 OUTPUT_VARIABLE _rm_out 49 RETURN_VALUE _rm_retval 50 ) 51 # complain only if the file still exists 52 IF (EXISTS "${_file}") 53 IF(NOT "${_rm_retval}" STREQUAL 0) 54 MESSAGE(FATAL_ERROR "Problem when removing \"${_file}\"") 55 ENDIF(NOT "${_rm_retval}" STREQUAL 0) 56 ENDIF(EXISTS "${_file}") 57 58 # clean up remainig empty directories 59 GET_FILENAME_COMPONENT(_dirname ${_file} PATH) 60 EXEC_PROGRAM( 61 "@RMDIR_EXECUTABLE@" 62 ARGS "--parents \"${_dirname}\"" 63 OUTPUT_VARIABLE _rmdir_out 64 ) 65 66ENDFOREACH(_file) 67 68############################################################################# 69############################################################################# 70