piotr | 437f546 | 2014-02-04 17:57:25 +0100 | [diff] [blame] | 1 | # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F |
| 2 | |
| 3 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") |
| 4 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") |
| 5 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") |
| 6 | |
| 7 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) |
| 8 | STRING(REGEX REPLACE "\n" ";" files "${files}") |
| 9 | FOREACH(file ${files}) |
| 10 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") |
| 11 | IF(EXISTS "$ENV{DESTDIR}${file}") |
| 12 | EXEC_PROGRAM( |
| 13 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" |
| 14 | OUTPUT_VARIABLE rm_out |
| 15 | RETURN_VALUE rm_retval |
| 16 | ) |
| 17 | IF(NOT "${rm_retval}" STREQUAL 0) |
| 18 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") |
| 19 | ENDIF(NOT "${rm_retval}" STREQUAL 0) |
| 20 | ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") |
| 21 | EXEC_PROGRAM( |
| 22 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" |
| 23 | OUTPUT_VARIABLE rm_out |
| 24 | RETURN_VALUE rm_retval |
| 25 | ) |
| 26 | IF(NOT "${rm_retval}" STREQUAL 0) |
| 27 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") |
| 28 | ENDIF(NOT "${rm_retval}" STREQUAL 0) |
| 29 | ELSE(EXISTS "$ENV{DESTDIR}${file}") |
| 30 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") |
| 31 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") |
| 32 | ENDFOREACH(file) |