File: cmake_uninstall.cmake.in

package info (click to toggle)
broccoli-python 0.61%2B1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 456 kB
  • sloc: python: 407; sh: 200; makefile: 21
file content (35 lines) | stat: -rw-r--r-- 1,161 bytes parent folder | download | duplicates (24)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function(uninstall_manifest manifestPath)
    file(READ "${manifestPath}" files)
    string(REGEX REPLACE "\n" ";" files "${files}")
    foreach (file ${files})
        set(fileName $ENV{DESTDIR}${file})

        if (EXISTS "${fileName}" OR IS_SYMLINK "${fileName}")
            message(STATUS "Uninstalling: ${fileName}")

            execute_process(
                COMMAND "@CMAKE_COMMAND@" -E remove "${fileName}"
                OUTPUT_VARIABLE rm_out
                RESULT_VARIABLE rm_retval
            )

            if (NOT ${rm_retval} EQUAL 0)
                message(FATAL_ERROR "Problem when removing: ${fileName}")
            endif ()
        else ()
            message(STATUS "Does not exist: ${fileName}")
        endif ()

    endforeach ()
endfunction(uninstall_manifest)

file(GLOB install_manifests @CMAKE_CURRENT_BINARY_DIR@/install_manifest*.txt)

if (install_manifests)
    foreach (manifest ${install_manifests})
        uninstall_manifest(${manifest})
    endforeach ()
else ()
    message(FATAL_ERROR "Cannot find any install manifests in: "
                        "\"@CMAKE_CURRENT_BINARY_DIR@/install_manifest*.txt\"")
endif ()