Skip to content

Commit

Permalink
Merge branch 'dev' into Update_DPDK_Version
Browse files Browse the repository at this point in the history
  • Loading branch information
clementperon authored Aug 22, 2023
2 parents 059065d + 843765f commit 59fecac
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -282,3 +282,14 @@ if(PCAPPP_INSTALL)
COMPONENT devel
DESTINATION "${PCAPPP_INSTALL_CMAKEDIR}")
endif()

# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/PcapPlusPlusUninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/PcapPlusPlusUninstall.cmake"
IMMEDIATE
@ONLY)

add_custom_target(uninstall COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/PcapPlusPlusUninstall.cmake")
endif()
6 changes: 5 additions & 1 deletion ci/cmake-format-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ set -e

SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "${SCRIPT}")
ROOTPATH=${SCRIPTPATH}/..
ROOTPATH=$(realpath "${SCRIPTPATH}"/..)
if ! command -v cmake-format; then
echo "cmake-format is not found!"
exit 1
fi

find "${ROOTPATH}" \( -name '*.cmake' -o -name 'CMakeLists.txt' \) -not -path "*/3rdParty/*" -exec echo 'Formatting:' {} ';' -exec cmake-format -i {} ';'
25 changes: 25 additions & 0 deletions cmake/PcapPlusPlusUninstall.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
endif()

file(READ "@CMAKE_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}")
# 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}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Error 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.")
endif()
endforeach()
file(REMOVE "@CMAKE_BINARY_DIR@/install_manifest.txt")

0 comments on commit 59fecac

Please sign in to comment.