2018-05-21 23:46:18 +00:00
|
|
|
# CMakeLists.txt
|
|
|
|
#
|
|
|
|
# Wireshark - Network traffic analyzer
|
|
|
|
# By Gerald Combs <gerald@wireshark.org>
|
|
|
|
# Copyright 1998 Gerald Combs
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#
|
|
|
|
|
2021-12-20 02:33:15 +00:00
|
|
|
cmake_minimum_required(VERSION 3.12)
|
2018-05-21 23:46:18 +00:00
|
|
|
cmake_policy(SET CMP0048 NEW)
|
|
|
|
|
|
|
|
project(Hello VERSION 0.0.1 DESCRIPTION "Wireshark Hello Plugin" LANGUAGES C)
|
|
|
|
|
2018-08-23 21:03:28 +00:00
|
|
|
find_package(Wireshark CONFIG REQUIRED)
|
2018-05-21 23:46:18 +00:00
|
|
|
|
2022-03-28 11:15:47 +00:00
|
|
|
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
|
|
set(CMAKE_INSTALL_PREFIX "${Wireshark_INSTALL_PREFIX}"
|
|
|
|
CACHE PATH "Installation prefix" FORCE
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2018-08-23 21:03:28 +00:00
|
|
|
if(NOT Wireshark_PLUGINS_ENABLED)
|
2021-02-06 16:35:51 +00:00
|
|
|
message(WARNING "Wireshark was compiled without support for plugins")
|
2018-05-21 23:46:18 +00:00
|
|
|
endif()
|
|
|
|
|
2021-12-20 02:33:15 +00:00
|
|
|
include(CheckTypeSize)
|
|
|
|
check_type_size("ssize_t" SSIZE_T)
|
|
|
|
|
2018-05-23 13:31:21 +00:00
|
|
|
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
|
|
|
if (CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
set(CMAKE_C_FLAGS "-Wall -Wextra ${CMAKE_C_FLAGS}")
|
|
|
|
endif()
|
|
|
|
|
2021-12-20 02:33:15 +00:00
|
|
|
add_compile_definitions(
|
|
|
|
VERSION=\"${PROJECT_VERSION}\"
|
|
|
|
$<$<BOOL:${HAVE_SSIZE_T}>:HAVE_SSIZE_T>
|
|
|
|
)
|
2018-05-21 23:46:18 +00:00
|
|
|
|
|
|
|
add_library(hello MODULE hello.c)
|
2018-05-23 13:31:21 +00:00
|
|
|
set_target_properties(hello PROPERTIES PREFIX "" DEFINE_SYMBOL "")
|
2018-08-23 21:03:28 +00:00
|
|
|
target_link_libraries(hello epan)
|
2018-05-21 23:46:18 +00:00
|
|
|
|
|
|
|
install(TARGETS hello
|
2022-03-28 11:15:47 +00:00
|
|
|
LIBRARY DESTINATION "${Wireshark_PLUGIN_LIBDIR}/epan" NAMELINK_SKIP
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target(copy_plugin
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:hello> ${Wireshark_PLUGIN_INSTALL_DIR}
|
|
|
|
COMMENT "Installing plugin to: ${Wireshark_PLUGIN_INSTALL_DIR}"
|
2018-05-21 23:46:18 +00:00
|
|
|
)
|
2022-03-28 11:16:54 +00:00
|
|
|
|
|
|
|
string(TOLOWER "${PROJECT_NAME}-${PROJECT_VERSION}" _pkgname)
|
|
|
|
|
|
|
|
add_custom_target(package_prep
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${_pkgname}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/README $<TARGET_FILE:hello> ${CMAKE_BINARY_DIR}/${_pkgname}
|
|
|
|
)
|
|
|
|
|
|
|
|
add_custom_target(package
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E tar czf ${CMAKE_BINARY_DIR}/${_pkgname}.tar.gz --format=gnutar -- ${CMAKE_BINARY_DIR}/${_pkgname}
|
|
|
|
)
|
|
|
|
add_dependencies(package package_prep)
|
|
|
|
|
|
|
|
add_custom_target(package_zip
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E tar cf ${CMAKE_BINARY_DIR}/${_pkgname}.zip --format=zip -- ${CMAKE_BINARY_DIR}/${_pkgname}
|
|
|
|
)
|
|
|
|
add_dependencies(package_zip package_prep)
|