• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
2  MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
3ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
4
5FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
6STRING(REGEX REPLACE "\n" ";" files "${files}")
7
8SET(NUM 0)
9FOREACH(file ${files})
10  IF(EXISTS "$ENV{DESTDIR}${file}")
11    MESSAGE(STATUS "Looking for \"$ENV{DESTDIR}${file}\" - found")
12    SET(UNINSTALL_CHECK_${NUM} 1)
13  ELSE(EXISTS "$ENV{DESTDIR}${file}")
14    MESSAGE(STATUS "Looking for \"$ENV{DESTDIR}${file}\" - not found")
15    SET(UNINSTALL_CHECK_${NUM} 0)
16  ENDIF(EXISTS "$ENV{DESTDIR}${file}")
17  MATH(EXPR NUM "1 + ${NUM}")
18ENDFOREACH(file)
19
20SET(NUM 0)
21FOREACH(file ${files})
22  IF(${UNINSTALL_CHECK_${NUM}})
23    MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
24    EXEC_PROGRAM(
25      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
26      OUTPUT_VARIABLE rm_out
27      RETURN_VALUE rm_retval
28      )
29    IF(NOT "${rm_retval}" STREQUAL 0)
30      MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
31    ENDIF(NOT "${rm_retval}" STREQUAL 0)
32  ENDIF(${UNINSTALL_CHECK_${NUM}})
33  MATH(EXPR NUM "1 + ${NUM}")
34ENDFOREACH(file)
35
36FILE(REMOVE "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
37