mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix uninstall target for cmake > 3.25
execute_process and exce_program were changed in cmake 3.26 to run only at configure time, breaking cmake_uninstall.cmake. The recommened replacement is add_custom_target and add_custom_commsnd, but there's no way to run a loop in either of those so this commit replaces cmake_uninstall.cmake with cmake_uninstall.sh. This works on Microsoft Windows beacuse at present we have to build on Windows in a MSYS2 shell. If at some point we gain the ability to build in a straight Windows environment then we'll need a Windows CMD equivalent.
This commit is contained in:
parent
57df6c2b47
commit
19591988e2
@ -958,12 +958,12 @@ add_custom_target(distcheck DEPENDS dist
|
|||||||
|
|
||||||
# uninstall target
|
# uninstall target
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
"${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.sh.in"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.sh"
|
||||||
@ONLY)
|
@ONLY)
|
||||||
|
|
||||||
add_custom_target(uninstall
|
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)
|
set(_MODULES gnc-core-utils gnc-engine gnc-app-utils gnc-module gnc-locale-tax gnc-backend-xml-utils gnucash-guile)
|
||||||
|
|
||||||
|
@ -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)
|
|
13
cmake/cmake_uninstall.sh.in
Normal file
13
cmake/cmake_uninstall.sh.in
Normal file
@ -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<install_manifest.txt
|
||||||
|
|
Loading…
Reference in New Issue
Block a user