-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcmake_uninstall.cmake.in
More file actions
37 lines (33 loc) · 1.42 KB
/
cmake_uninstall.cmake.in
File metadata and controls
37 lines (33 loc) · 1.42 KB
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
message(STATUS "Removing special files")
file(REMOVE "${CMAKE_INSTALL_PREFIX}/bin/cufetch") # Symlink
if(EXISTS "${CMAKE_INSTALL_PREFIX}/bin/customfetch-gui")
file(REMOVE "${CMAKE_INSTALL_PREFIX}/bin/customfetch-gui") # GUI executable
endif()
if(EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(STATUS "Processing install manifest")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
if(EXISTS "${file}" OR IS_SYMLINK "${file}")
message(STATUS "Removing: ${file}")
file(REMOVE "${file}")
# Remove empty parent directories
get_filename_component(dir "${file}" DIRECTORY)
while(NOT dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
file(GLOB contents "${dir}/*")
if(NOT contents)
message(STATUS "Removing empty directory: ${dir}")
file(REMOVE_RECURSE "${dir}")
get_filename_component(dir "${dir}" DIRECTORY)
else()
break()
endif()
endwhile()
else()
message(STATUS "File not found (may be already removed): ${file}")
endif()
endforeach()
else()
message(WARNING "Install manifest not found - some files may remain")
endif()
message(STATUS "Uninstallation complete")