Menu

[bcb3ce]: / cmake_uninstall.cmake.in  Maximize  Restore  History

Download this file

32 lines (29 with data), 1.3 kB

# Copyright (C) 2009-2026 Robin Stuart <rstuart114@gmail.com>
# vim: set ts=4 sw=4 et :

if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
    message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif()

file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
    if(file MATCHES "(^.*/zint/)[^/]+$")
        list(FIND dirs ${CMAKE_MATCH_1} fnd_dir)
        if (fnd_dir EQUAL -1)
            list(APPEND dirs ${CMAKE_MATCH_1})
        endif()
    endif()
    message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
    if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.17")
        execute_process(COMMAND "@CMAKE_COMMAND@" "-E" "rm" "--" "$ENV{DESTDIR}${file}" RESULT_VARIABLE rm_res)
    else()
        execute_process(COMMAND "@CMAKE_COMMAND@" "-E" "remove" "$ENV{DESTDIR}${file}" RESULT_VARIABLE rm_res)
    endif()
    if(rm_res)
        message(WARNING "Failed to remove \"$ENV{DESTDIR}${file}\"")
    endif()
endforeach(file)
foreach(dir ${dirs})
    if (EXISTS "$ENV{DESTDIR}${dir}" AND IS_DIRECTORY "$ENV{DESTDIR}${dir}")
        message(STATUS "Note: did not remove directory \"$ENV{DESTDIR}${dir}\"")
    endif()
endforeach(dir)