Restore cmake_uninstall.cmake.in using file(REMOVE).

Instead of execute_process. It's more portable long-term.
This commit is contained in:
John Ralls 2025-02-02 09:32:29 -08:00
parent 618cd55826
commit b5c1937702
4 changed files with 23 additions and 17 deletions

View File

@ -958,12 +958,12 @@ add_custom_target(distcheck DEPENDS dist
# uninstall target
configure_file(
"${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.sh.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.sh"
"${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
@ONLY)
add_custom_target(uninstall
COMMAND /bin/sh ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.sh)
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
set(_MODULES gnc-core-utils gnc-engine gnc-app-utils gnc-module gnc-locale-tax gnc-backend-xml-utils gnucash-guile)

View File

@ -11,7 +11,7 @@ endif()
set_dist_list(cmake_DIST
CMakeLists.txt
README_CMAKE.txt
cmake_uninstall.sh.in
cmake_uninstall.cmake.in
configure-appdata.cmake
configure-gnucash-desktop.cmake
configure-manpage.cmake

View File

@ -0,0 +1,19 @@
# 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}")
file(REMOVE "$ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif()
else()
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif()
endforeach(file)

View File

@ -1,13 +0,0 @@
#!/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<install_manifest.txt