gnucash stable: Restore cmake_uninstall.cmake.in using file(REMOVE).
John Ralls
jralls at code.gnucash.org
Sun Feb 2 12:34:28 EST 2025
Updated via https://github.com/Gnucash/gnucash/commit/b5c19377 (commit)
from https://github.com/Gnucash/gnucash/commit/618cd558 (commit)
commit b5c1937702ca7a8fba772a47b2ac7fa6b8857bf5
Author: John Ralls <jralls at ceridwen.us>
Date: Sun Feb 2 09:32:29 2025 -0800
Restore cmake_uninstall.cmake.in using file(REMOVE).
Instead of execute_process. It's more portable long-term.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 614e0edb0c..0f9d0ad921 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.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)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index f1bad02550..bb2f449514 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -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
diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in
new file mode 100644
index 0000000000..f74680c890
--- /dev/null
+++ b/cmake/cmake_uninstall.cmake.in
@@ -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)
diff --git a/cmake/cmake_uninstall.sh.in b/cmake/cmake_uninstall.sh.in
deleted file mode 100644
index 88c0583efa..0000000000
--- a/cmake/cmake_uninstall.sh.in
+++ /dev/null
@@ -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
-
Summary of changes:
CMakeLists.txt | 6 +++---
cmake/CMakeLists.txt | 2 +-
cmake/cmake_uninstall.cmake.in | 19 +++++++++++++++++++
cmake/cmake_uninstall.sh.in | 13 -------------
4 files changed, 23 insertions(+), 17 deletions(-)
create mode 100644 cmake/cmake_uninstall.cmake.in
delete mode 100644 cmake/cmake_uninstall.sh.in
More information about the gnucash-changes
mailing list