| 1 |
#[=======================================================================[.rst: |
| 2 |
Uninstall |
| 3 |
--------- |
| 4 |
|
| 5 |
Uninstall script from |
| 6 |
https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake |
| 7 |
|
| 8 |
#]=======================================================================] |
| 9 |
|
| 10 |
if(NOT EXISTS "@PROJECT_BINARY_DIR@/install_manifest.txt") |
| 11 |
message(FATAL_ERROR "Cannot find install manifest: @PROJECT_BINARY_DIR@/install_manifest.txt") |
| 12 |
endif(NOT EXISTS "@PROJECT_BINARY_DIR@/install_manifest.txt") |
| 13 |
|
| 14 |
file(READ "@PROJECT_BINARY_DIR@/install_manifest.txt" files) |
| 15 |
string(REGEX REPLACE "\n" ";" files "${files}") |
| 16 |
foreach(file ${files}) |
| 17 |
message(STATUS "Uninstalling $ENV{DESTDIR}${file}") |
| 18 |
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") |
| 19 |
exec_program( |
| 20 |
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" |
| 21 |
OUTPUT_VARIABLE rm_out |
| 22 |
RETURN_VALUE rm_retval |
| 23 |
) |
| 24 |
if(NOT "${rm_retval}" STREQUAL 0) |
| 25 |
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") |
| 26 |
endif(NOT "${rm_retval}" STREQUAL 0) |
| 27 |
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") |
| 28 |
message(STATUS "File $ENV{DESTDIR}${file} does not exist.") |
| 29 |
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") |
| 30 |
endforeach(file) |