1# This code is from the CMake FAQ 2 3if (NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 4 message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"") 5endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 6 7file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) 8string(REGEX REPLACE "\n" ";" files "${files}") 9list(REVERSE files) 10foreach (file ${files}) 11 message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 12 if (EXISTS "$ENV{DESTDIR}${file}") 13 execute_process( 14 COMMAND "@CMAKE_COMMAND@" -E remove "$ENV{DESTDIR}${file}" 15 OUTPUT_VARIABLE rm_out 16 RESULT_VARIABLE rm_retval 17 ) 18 if(NOT ${rm_retval} EQUAL 0) 19 message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 20 endif (NOT ${rm_retval} EQUAL 0) 21 else (EXISTS "$ENV{DESTDIR}${file}") 22 message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 23 endif (EXISTS "$ENV{DESTDIR}${file}") 24endforeach(file) 25