diff options
Diffstat (limited to 'cmake/scripts/common/Uninstall.cmake')
| -rw-r--r-- | cmake/scripts/common/Uninstall.cmake | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cmake/scripts/common/Uninstall.cmake b/cmake/scripts/common/Uninstall.cmake new file mode 100644 index 0000000..5660e19 --- /dev/null +++ b/cmake/scripts/common/Uninstall.cmake | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | # Uninstall target | ||
| 2 | set(MANIFEST ${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt) | ||
| 3 | if(EXISTS ${MANIFEST}) | ||
| 4 | file(STRINGS ${MANIFEST} files) | ||
| 5 | foreach(file IN LISTS files) | ||
| 6 | if(EXISTS $ENV{DESTDIR}${file}) | ||
| 7 | message(STATUS "Uninstalling: ${file}") | ||
| 8 | execute_process( | ||
| 9 | COMMAND ${CMAKE_COMMAND} -E remove $ENV{DESTDIR}${file} | ||
| 10 | OUTPUT_VARIABLE rm_out | ||
| 11 | RESULT_VARIABLE rm_retval | ||
| 12 | ) | ||
| 13 | if(NOT "${rm_retval}" STREQUAL 0) | ||
| 14 | message(FATAL_ERROR "Failed to remove file: $ENV{DESTDIR}${file}") | ||
| 15 | endif() | ||
| 16 | else() | ||
| 17 | message(STATUS "File does not exist: $ENV{DESTDIR}${file}") | ||
| 18 | endif() | ||
| 19 | endforeach(file) | ||
| 20 | else() | ||
| 21 | message(STATUS "Cannot find install manifest: '${MANIFEST}'") | ||
| 22 | endif() | ||
