diff --git a/CMake/cmake_uninstall.in.cmake b/CMake/cmake_uninstall.in.cmake index c7fd8008e1..30e812b124 100644 --- a/CMake/cmake_uninstall.in.cmake +++ b/CMake/cmake_uninstall.in.cmake @@ -26,18 +26,22 @@ if(NOT EXISTS "${_manifest}") message(FATAL_ERROR "Cannot find install manifest: ${_manifest}") endif() -if(NOT DEFINED CMAKE_INSTALL_PREFIX) - set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@") +set(_destdir "$ENV{DESTDIR}") +if(NOT _destdir STREQUAL "") + message(STATUS "DESTDIR environment: ${_destdir}") endif() -message(${CMAKE_INSTALL_PREFIX}) file(READ "${_manifest}" _files) string(REGEX REPLACE "\n" ";" _files "${_files}") foreach(_file IN LISTS _files) - set(_target "$ENV{DESTDIR}${_file}") - message(STATUS "Uninstalling ${_target}") + set(_target "${_destdir}${_file}") if(IS_SYMLINK "${_target}" OR EXISTS "${_target}") - execute_process(COMMAND "@CMAKE_COMMAND@" -E rm -f -- "${_target}") + file(REMOVE "${_target}") + if(IS_SYMLINK "${_target}" OR EXISTS "${_target}") + message(STATUS "Failed to delete: ${_target}") + else() + message(STATUS "Uninstalled: ${_target}") + endif() else() message(STATUS "File does not exist: ${_target}") endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index c0071f1a07..5929b741ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2452,9 +2452,7 @@ if(NOT CURL_DISABLE_INSTALL) DESTINATION ${_install_cmake_dir}) if(NOT TARGET curl_uninstall) - # Consumed variables: - # CMAKE_COMMAND - # CMAKE_INSTALL_PREFIX + # Consumed variable: # PROJECT_BINARY_DIR configure_file( "${PROJECT_SOURCE_DIR}/CMake/cmake_uninstall.in.cmake"