xref: /aosp_15_r20/external/zstd/build/cmake/lib/cmake_uninstall.cmake.in (revision 01826a4963a0d8a59bc3812d29bdf0fb76416722)
1*01826a49SYabin Cui
2*01826a49SYabin Cuiif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
3*01826a49SYabin Cui  message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
4*01826a49SYabin Cuiendif()
5*01826a49SYabin Cui
6*01826a49SYabin Cuifile(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
7*01826a49SYabin Cuistring(REGEX REPLACE "\n" ";" files "${files}")
8*01826a49SYabin Cuiforeach(file ${files})
9*01826a49SYabin Cui  message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
10*01826a49SYabin Cui  if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
11*01826a49SYabin Cui    exec_program(
12*01826a49SYabin Cui      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
13*01826a49SYabin Cui      OUTPUT_VARIABLE rm_out
14*01826a49SYabin Cui      RETURN_VALUE rm_retval
15*01826a49SYabin Cui      )
16*01826a49SYabin Cui    if(NOT "${rm_retval}" STREQUAL 0)
17*01826a49SYabin Cui      message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
18*01826a49SYabin Cui    endif()
19*01826a49SYabin Cui  else()
20*01826a49SYabin Cui    message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
21*01826a49SYabin Cui  endif()
22*01826a49SYabin Cuiendforeach()
23