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