xref: /aosp_15_r20/external/libconfig/contrib/cmake/cmake_work/cmake_uninstall.cmake.in (revision 2e9d491483b805f09ea864149eadd5680efcc72a)
1# Copyright 2006-2008 The FLWOR Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
16  MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
17ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
18
19FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
20STRING(REGEX REPLACE "\n" ";" files "${files}")
21FOREACH(file ${files})
22  MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
23  IF(EXISTS "$ENV{DESTDIR}${file}")
24  EXEC_PROGRAM(
25      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
26      OUTPUT_VARIABLE rm_out
27      RETURN_VALUE rm_retval
28      )
29  IF("${rm_retval}" STREQUAL 0)
30  ELSE("${rm_retval}" STREQUAL 0)
31    MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
32  ENDIF("${rm_retval}" STREQUAL 0)
33  ELSE(EXISTS "$ENV{DESTDIR}${file}")
34  MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
35  ENDIF(EXISTS "$ENV{DESTDIR}${file}")
36ENDFOREACH(file)
37