diff options
author | Guy Harris <gharris@sonic.net> | 2021-08-26 00:42:51 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2021-08-26 00:42:51 -0700 |
commit | ea0f14a6fb52c925899a482053bf27ff7e7ea07c (patch) | |
tree | 25a68e8f21ccc7da524e6efc1fa4832257ca133f /cmake_uninstall.cmake.in | |
parent | 322ae5037ad83f75c85fa73ad8ca4d4658c3f42d (diff) |
cmake: add an "uninstall" target.
Based on the uninstall target I added to libpcap and tcpdump's CMake
files. cmake_uninstall.cmake.in is BSD-licensed, so I can use it here
and in libpcap/tcpdump without adding any GPL stuff to libpcap/tcpdump.
Diffstat (limited to 'cmake_uninstall.cmake.in')
-rw-r--r-- | cmake_uninstall.cmake.in | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in new file mode 100644 index 0000000000..2cc12c8042 --- /dev/null +++ b/cmake_uninstall.cmake.in @@ -0,0 +1,43 @@ +/* cmake_uninstall.cmake.in +# +# Wireshark - Network traffic analyzer +# By Gerald Combs <gerald@wireshark.org> +# Copyright 1998 Gerald Combs +# +# SPDX-License-Identifier: BSD-3-Clause +# + +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(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +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}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif(NOT "${rm_retval}" STREQUAL 0) + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") +endforeach(file) + +# +# Editor modelines - https://www.wireshark.org/tools/modelines.html +# +# Local variables: +# c-basic-offset: 2 +# tab-width: 2 +# indent-tabs-mode: nil +# End: +# +# vi: set shiftwidth=2 tabstop=2 noexpandtab: +# :indentSize=8:tabSize=8:noTabs=false: +# |