Skip to content

Commit

Permalink
Merge pull request #1426 from jsnowy/fixUninstall
Browse files Browse the repository at this point in the history
Replaced deprecated cmd to fix package uninstall
  • Loading branch information
Nightwalker-87 authored Oct 3, 2024
2 parents e493109 + 0931135 commit a548e83
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cmake_uninstall.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@ 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
# remove deprecated: use rm instead,
# because it does not check the file path, even return an error.
COMMAND "@CMAKE_COMMAND@" -E rm "$ENV{DESTDIR}${file}"
RESULT_VARIABLE rm_retval
ERROR_VARIABLE rm_err
)
if (NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}\n${rm_err}")
# Detect whether the file has been removed.
elseif (IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(FATAL_ERROR "File has not been removed.\n${rm_err}")
else ()
message(STATUS "File has been removed.")
endif ()
else (IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
else ()
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif ()
endforeach ()

0 comments on commit a548e83

Please sign in to comment.