z3/cmake/cmake_uninstall.cmake.in

25 lines
942 B
CMake
Raw Permalink Normal View History

2022-08-15 16:26:39 +08:00
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})
set(_full_file_path "$ENV{DESTDIR}${file}")
message(STATUS "Uninstalling ${_full_file_path}")
if(IS_SYMLINK "${_full_file_path}" OR EXISTS "${_full_file_path}")
# We could use ``file(REMOVE ...)`` here but then we wouldn't
# know if the removal failed.
execute_process(COMMAND
"@CMAKE_COMMAND@" "-E" "remove" "${_full_file_path}"
RESULT_VARIABLE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing \"${_full_file_path}\"")
endif()
else()
message(STATUS "File \"${_full_file_path}\" does not exist.")
endif()
endforeach()