Home | History | Annotate | Download | only in cmakescripts
      1 # This code is from the CMake FAQ
      2 
      3 if (NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
      4   message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"")
      5 endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
      6 
      7 file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
      8 string(REGEX REPLACE "\n" ";" files "${files}")
      9 list(REVERSE files)
     10 foreach (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}")
     24 endforeach(file)
     25