Skip to content

Commit

Permalink
cmake: convert deprecated exec_program() to execute_process() (#1570)
Browse files Browse the repository at this point in the history
  • Loading branch information
clementperon authored Sep 19, 2024
1 parent 84e2581 commit 6955222
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions cmake/PcapPlusPlusUninstall.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ 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}")
# If the file exists or is symlink
# run remove command through cmake in command mode
# See https://cmake.org/cmake/help/latest/manual/cmake.1.html#run-a-command-line-tool
exec_program(
"@CMAKE_COMMAND@" ARGS "-E rm -rf \"$ENV{DESTDIR}${file}\""
execute_process(
COMMAND "@CMAKE_COMMAND@" -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
RESULT_VARIABLE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Error when removing $ENV{DESTDIR}${file}")
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif()
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
Expand Down

0 comments on commit 6955222

Please sign in to comment.