uninstall.cmake 728 B

123456789101112131415161718192021222324252627
  1. cmake_minimum_required(VERSION 2.8.5)
  2. set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt")
  3. if(NOT EXISTS ${MANIFEST})
  4. message(FATAL_ERROR "Cannot find install mainfest: ${MANIFEST}")
  5. endif()
  6. file(STRINGS ${MANIFEST} files)
  7. foreach(file ${files})
  8. if(EXISTS ${file} OR IS_SYMLINK ${file})
  9. message(STATUS "Removing: ${file}")
  10. execute_process(COMMAND rm -f ${file}
  11. RESULT_VARIABLE result
  12. OUTPUT_QUIET
  13. ERROR_VARIABLE stderr
  14. ERROR_STRIP_TRAILING_WHITESPACE
  15. )
  16. if(NOT ${result} EQUAL 0)
  17. message(FATAL_ERROR "${stderr}")
  18. endif()
  19. else()
  20. message(STATUS "Does-not-exist: ${file}")
  21. endif()
  22. endforeach(file)