Replace deprecated cmd to Fix Uninstall

pull/1426/head
jsnowy 2024-09-15 21:48:39 +08:00
rodzic 25785b92db
commit 3b47f22293
1 zmienionych plików z 14 dodań i 7 usunięć

Wyświetl plik

@ -7,15 +7,22 @@ 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}")
exec_program("@CMAKE_COMMAND@"
ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
execute_process(
# 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 ()
endforeach ()