-
Notifications
You must be signed in to change notification settings - Fork 8
/
cmake_uninstall.cmake.in
51 lines (37 loc) · 1.94 KB
/
cmake_uninstall.cmake.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#------------------------------------------------------------------------------
# CMake "uninstall" script
#------------------------------------------------------------------------------
#
# Our project's primary cmake script creates a make uninstall target
# to invoke cmake in script mode ("-P" argument) that asks cmake to
# run the below script. The below script, when run, simply deletes
# every file that was installed.
#
# CMake creates a file called "install_manifest.txt" when executing
# the 'install' target (i.e. "make install"). This file is just a
# simple list of all of the files which were installed. The below
# cmake script simply reads the contents of this file, converts it
# into a semicolon delimited cmake LIST and then passes each LIST
# entry in turn to cmake for deletion ("-E" Command-Line Tool Mode
# with the cmake command being "remove", which deletes the file).
#
#------------------------------------------------------------------------------
if( NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" )
message( FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" )
endif()
file( READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files )
string( REGEX REPLACE "\n" ";" files "${files}" )
foreach( file ${files} )
set( _this_file "$ENV{DESTDIR}${file}" )
message( STATUS "Uninstalling \"${_this_file}\"" )
if( IS_SYMLINK "${_this_file}" OR EXISTS "${_this_file}" )
execute_process( COMMAND "@CMAKE_COMMAND@" -E remove "${_this_file}"
OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE _exit_code )
if( NOT "${_exit_code}" STREQUAL 0 )
message( FATAL_ERROR "Problem removing file \"${_this_file}\"" )
endif()
else()
message( STATUS "File \"${_this_file}\" does not exist." )
endif()
endforeach()
#------------------------------------------------------------------------------