xref: /aosp_15_r20/external/libevent/cmake/Uninstall.cmake.in (revision 663afb9b963571284e0f0a60f257164ab54f64bf)
1*663afb9bSAndroid Build Coastguard Worker# https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake
2*663afb9bSAndroid Build Coastguard Worker
3*663afb9bSAndroid Build Coastguard Workerif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
4*663afb9bSAndroid Build Coastguard Worker  message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
5*663afb9bSAndroid Build Coastguard Workerendif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
6*663afb9bSAndroid Build Coastguard Worker
7*663afb9bSAndroid Build Coastguard Workerfile(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
8*663afb9bSAndroid Build Coastguard Workerstring(REGEX REPLACE "\n" ";" files "${files}")
9*663afb9bSAndroid Build Coastguard Workerforeach(file ${files})
10*663afb9bSAndroid Build Coastguard Worker  message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
11*663afb9bSAndroid Build Coastguard Worker  if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
12*663afb9bSAndroid Build Coastguard Worker    exec_program(
13*663afb9bSAndroid Build Coastguard Worker      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
14*663afb9bSAndroid Build Coastguard Worker      OUTPUT_VARIABLE rm_out
15*663afb9bSAndroid Build Coastguard Worker      RETURN_VALUE rm_retval
16*663afb9bSAndroid Build Coastguard Worker      )
17*663afb9bSAndroid Build Coastguard Worker    if(NOT "${rm_retval}" STREQUAL 0)
18*663afb9bSAndroid Build Coastguard Worker      message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
19*663afb9bSAndroid Build Coastguard Worker    endif(NOT "${rm_retval}" STREQUAL 0)
20*663afb9bSAndroid Build Coastguard Worker  else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
21*663afb9bSAndroid Build Coastguard Worker    message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
22*663afb9bSAndroid Build Coastguard Worker  endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
23*663afb9bSAndroid Build Coastguard Workerendforeach(file)
24