11
by Olivier Tilloy
Replace qmake with cmake, for more advanced features. |
1 |
# Source: http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F |
2 |
||
3 |
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") |
|
4 |
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") |
|
5 |
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") |
|
6 |
||
7 |
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) |
|
8 |
string(REGEX REPLACE "\n" ";" files "${files}") |
|
9 |
list(REVERSE files) |
|
10 |
foreach (file ${files}) |
|
11 |
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") |
|
12 |
if (EXISTS "$ENV{DESTDIR}${file}") |
|
13 |
execute_process( |
|
14 |
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" |
|
15 |
OUTPUT_VARIABLE rm_out |
|
16 |
RESULT_VARIABLE rm_retval |
|
17 |
) |
|
18 |
if(NOT ${rm_retval} EQUAL 0) |
|
19 |
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") |
|
20 |
endif (NOT ${rm_retval} EQUAL 0) |
|
21 |
else (EXISTS "$ENV{DESTDIR}${file}") |
|
22 |
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") |
|
23 |
endif (EXISTS "$ENV{DESTDIR}${file}") |
|
24 |
endforeach(file) |
|
25 |