Mercurial > hg > orthanc
comparison Resources/CMake/Uninstall.cmake.in @ 584:a042693cc6a9
uninstall target for make
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 02 Oct 2013 14:21:43 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
583:bf333b2ed95d | 584:a042693cc6a9 |
---|---|
1 # Code taken from the CMake FAQ | |
2 # http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F | |
3 | |
4 if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | |
5 message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") | |
6 endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | |
7 | |
8 file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) | |
9 string(REGEX REPLACE "\n" ";" files "${files}") | |
10 list(REVERSE files) | |
11 foreach (file ${files}) | |
12 message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") | |
13 if (EXISTS "$ENV{DESTDIR}${file}") | |
14 execute_process( | |
15 COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" | |
16 OUTPUT_VARIABLE rm_out | |
17 RESULT_VARIABLE rm_retval | |
18 ) | |
19 if(NOT ${rm_retval} EQUAL 0) | |
20 message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") | |
21 endif (NOT ${rm_retval} EQUAL 0) | |
22 else (EXISTS "$ENV{DESTDIR}${file}") | |
23 message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") | |
24 endif (EXISTS "$ENV{DESTDIR}${file}") | |
25 endforeach(file) |