xref: /freebsd/contrib/libpcap/cmake_uninstall.cmake.in (revision b00ab7548b418624b6719ab8a2e8aaeade767a70)
1*b00ab754SHans Petter Selaskyif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
2*b00ab754SHans Petter Selasky  message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
3*b00ab754SHans Petter Selaskyendif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
4*b00ab754SHans Petter Selasky
5*b00ab754SHans Petter Selaskyfile(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
6*b00ab754SHans Petter Selaskystring(REGEX REPLACE "\n" ";" files "${files}")
7*b00ab754SHans Petter Selaskyforeach(file ${files})
8*b00ab754SHans Petter Selasky  message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
9*b00ab754SHans Petter Selasky  if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
10*b00ab754SHans Petter Selasky    exec_program(
11*b00ab754SHans Petter Selasky      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
12*b00ab754SHans Petter Selasky      OUTPUT_VARIABLE rm_out
13*b00ab754SHans Petter Selasky      RETURN_VALUE rm_retval
14*b00ab754SHans Petter Selasky      )
15*b00ab754SHans Petter Selasky    if(NOT "${rm_retval}" STREQUAL 0)
16*b00ab754SHans Petter Selasky      message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
17*b00ab754SHans Petter Selasky    endif(NOT "${rm_retval}" STREQUAL 0)
18*b00ab754SHans Petter Selasky  else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
19*b00ab754SHans Petter Selasky    message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
20*b00ab754SHans Petter Selasky  endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
21*b00ab754SHans Petter Selaskyendforeach(file)
22