-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.cmake
68 lines (65 loc) · 2.48 KB
/
uninstall.cmake
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
file(STRINGS "install_manifest.txt" MANIFEST_FILE)
set(MANIFEST "${MANIFEST_FILE}")
while(MANIFEST)
list(POP_FRONT MANIFEST FILEPATH)
if(EXISTS "${FILEPATH}")
message("-- Uninstalling: ${FILEPATH}")
file(REMOVE "${FILEPATH}")
if (EXISTS "${FILEPATH}")
message(FATAL_ERROR "Could not delete ${FILEPATH}")
endif()
endif()
endwhile()
set(MANIFEST "${MANIFEST_FILE}")
while(MANIFEST)
list(POP_FRONT MANIFEST FILEPATH)
get_filename_component(DIRPATH "${FILEPATH}" DIRECTORY)
get_filename_component(DIRNAME "${DIRPATH}" NAME)
if("${DIRNAME}" STREQUAL "${CMAKE_ARGV3}"
AND NOT ("${DIRNAME}" STREQUAL "apps")
AND NOT ("${DIRNAME}" STREQUAL "icons")
AND NOT ("${DIRNAME}" STREQUAL "include")
AND NOT ("${DIRNAME}" STREQUAL "share")
AND NOT ("${DIRNAME}" STREQUAL "bin")
AND NOT ("${DIRNAME}" STREQUAL "lib")
AND NOT ("${DIRNAME}" STREQUAL "lib32")
AND NOT ("${DIRNAME}" STREQUAL "lib64"))
if(EXISTS "${DIRPATH}")
message("-- Uninstalling: ${DIRPATH}")
file(REMOVE_RECURSE "${DIRPATH}")
if (EXISTS "${DIRPATH}")
message(FATAL_ERROR "Could not delete ${DIRPATH}")
endif()
endif()
endif()
endwhile()
if(WIN32)
set(MANIFEST "${MANIFEST_FILE}")
while(MANIFEST)
list(POP_FRONT MANIFEST FILEPATH)
get_filename_component(DIRPATH "${FILEPATH}" DIRECTORY)
get_filename_component(DIRPATH "${DIRPATH}" DIRECTORY)
get_filename_component(DIRNAME "${DIRPATH}" NAME)
if("${DIRNAME}" STREQUAL "${CMAKE_ARGV3}"
AND NOT ("${DIRNAME}" STREQUAL "apps")
AND NOT ("${DIRNAME}" STREQUAL "icons")
AND NOT ("${DIRNAME}" STREQUAL "include")
AND NOT ("${DIRNAME}" STREQUAL "share")
AND NOT ("${DIRNAME}" STREQUAL "bin")
AND NOT ("${DIRNAME}" STREQUAL "lib")
AND NOT ("${DIRNAME}" STREQUAL "lib32")
AND NOT ("${DIRNAME}" STREQUAL "lib64"))
if(EXISTS "${DIRPATH}")
file(GLOB_RECURSE FILEPATHS LIST_DIRECTORIES false "${DIRPATH}/*")
message("${FILEPATHS}")
if(NOT FILEPATHS)
message("-- Uninstalling: ${DIRPATH}")
file(REMOVE_RECURSE "${DIRPATH}")
if (EXISTS "${DIRPATH}")
message(FATAL_ERROR "Could not delete ${DIRPATH}")
endif()
endif()
endif()
endif()
endwhile()
endif()