cmake_uninstall.cmake.in 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. #
  10. # This software is licensed as described in the file COPYING, which
  11. # you should have received as part of this distribution. The terms
  12. # are also available at https://curl.se/docs/copyright.html.
  13. #
  14. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. # copies of the Software, and permit persons to whom the Software is
  16. # furnished to do so, under the terms of the COPYING file.
  17. #
  18. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. # KIND, either express or implied.
  20. #
  21. # SPDX-License-Identifier: curl
  22. #
  23. ###########################################################################
  24. if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
  25. message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
  26. endif()
  27. if(NOT DEFINED CMAKE_INSTALL_PREFIX)
  28. set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
  29. endif()
  30. message(${CMAKE_INSTALL_PREFIX})
  31. file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
  32. string(REGEX REPLACE "\n" ";" files "${files}")
  33. foreach(file ${files})
  34. message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
  35. if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
  36. exec_program(
  37. "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
  38. OUTPUT_VARIABLE rm_out
  39. RETURN_VALUE rm_retval
  40. )
  41. if(NOT "${rm_retval}" STREQUAL 0)
  42. message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
  43. endif()
  44. else()
  45. message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
  46. endif()
  47. endforeach()