diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f9d0ad921..614e0edb0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -958,12 +958,12 @@ add_custom_target(distcheck DEPENDS dist # uninstall target configure_file( - "${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + "${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.sh.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.sh" @ONLY) add_custom_target(uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + COMMAND /bin/sh ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.sh) set(_MODULES gnc-core-utils gnc-engine gnc-app-utils gnc-module gnc-locale-tax gnc-backend-xml-utils gnucash-guile) diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in deleted file mode 100644 index 91dfd32965..0000000000 --- a/cmake/cmake_uninstall.cmake.in +++ /dev/null @@ -1,23 +0,0 @@ -# This is taken from https://cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F - -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}) - message(STATUS "Uninstalling $ENV{DESTDIR}${file}") - if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - execute_process( - COMMAND ${CMAKE_COMMAND} -E remove \"$ENV{DESTDIR}${file}\" - OUTPUT_VARIABLE rm_out - RESULT_VARIABLE rm_retval - ) - if(NOT "${rm_retval}" STREQUAL 0) - message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") - endif() - else() - message(STATUS "File $ENV{DESTDIR}${file} does not exist.") - endif() -endforeach(file) diff --git a/cmake/cmake_uninstall.sh.in b/cmake/cmake_uninstall.sh.in new file mode 100644 index 0000000000..88c0583efa --- /dev/null +++ b/cmake/cmake_uninstall.sh.in @@ -0,0 +1,13 @@ +#!/bin/sh +if [ ! -s install_manifest.txt ]; then + echo "Error: No install manifest." +fi +while IFS= read -r filename; do + if [ -e $filename ]; then + echo "--Uninstalling $filename" + rm $filename + else + echo "--$filename not found" + fi +done