cmake-uninstall.cmake.in 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
  2. message(
  3. FATAL_ERROR
  4. "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt"
  5. )
  6. endif()
  7. file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
  8. string(REGEX REPLACE "\n" ";" files "${files}")
  9. list(APPEND files "@CMAKE_INSTALL_PREFIX@/etc/@MAIN_NAME@/@[email protected]")
  10. list(APPEND files "@CMAKE_INSTALL_PREFIX@/etc/@MAIN_NAME@/kamctlrc")
  11. list(REMOVE_DUPLICATES files)
  12. foreach(file ${files})
  13. message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
  14. if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
  15. execute_process(
  16. COMMAND "${CMAKE_COMMAND}" -E remove "$ENV{DESTDIR}${file}"
  17. RESULT_VARIABLE rm_retval
  18. OUTPUT_VARIABLE rm_out
  19. )
  20. # exec_program(
  21. # "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
  22. # OUTPUT_VARIABLE rm_out
  23. # RETURN_VALUE rm_retval
  24. # )
  25. if(NOT "${rm_retval}" STREQUAL 0)
  26. message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
  27. endif()
  28. else()
  29. message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
  30. endif()
  31. endforeach()