Skip to content

Commit

Permalink
Restore cmake_uninstall.cmake.in using file(REMOVE).
Browse files Browse the repository at this point in the history
Instead of execute_process. It's more portable long-term.
  • Loading branch information
jralls committed Feb 2, 2025
1 parent 618cd55 commit b5c1937
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions cmake/cmake_uninstall.cmake.in
Original file line number Diff line number Diff line change
@@ -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)
13 changes: 0 additions & 13 deletions cmake/cmake_uninstall.sh.in

This file was deleted.

0 comments on commit b5c1937

Please sign in to comment.