forked from osmocom/wireshark
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.
This commit is contained in:
parent
322ae5037a
commit
ea0f14a6fb
|
@ -3656,6 +3656,15 @@ if(SHELLCHECK_EXECUTABLE)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# uninstall target
|
||||||
|
configure_file(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||||
|
IMMEDIATE @ONLY)
|
||||||
|
|
||||||
|
add_custom_target(uninstall
|
||||||
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Editor modelines - https://www.wireshark.org/tools/modelines.html
|
# Editor modelines - https://www.wireshark.org/tools/modelines.html
|
||||||
#
|
#
|
||||||
|
|
|
@ -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:
|
||||||
|
#
|
Loading…
Reference in New Issue