1 # ----------------------------------------------- 2 # File that provides "make uninstall" target 3 # We use the file 'install_manifest.txt' 4 # ----------------------------------------------- 5 IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 7 ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 8 9 FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 10 STRING(REGEX REPLACE "\n" ";" files "${files}") 11 FOREACH(file ${files}) 12 MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 13 IF(EXISTS "$ENV{DESTDIR}${file}") 14 EXEC_PROGRAM( 15 "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 16 OUTPUT_VARIABLE rm_out 17 RETURN_VALUE rm_retval 18 ) 19 IF(NOT "${rm_retval}" STREQUAL 0) 20 MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 21 ENDIF(NOT "${rm_retval}" STREQUAL 0) 22 ELSE(EXISTS "$ENV{DESTDIR}${file}") 23 MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 24 ENDIF(EXISTS "$ENV{DESTDIR}${file}") 25 ENDFOREACH(file) 26