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
|
|
|
|
#
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.1)
|
|
|
|
cmake_policy(SET CMP0048 NEW)
|
|
|
|
|
|
|
|
project(Hello VERSION 0.0.1 DESCRIPTION "Wireshark Hello Plugin" LANGUAGES C)
|
|
|
|
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
|
|
|
|
pkg_check_modules(WIRESHARK REQUIRED wireshark>=2.5)
|
2018-08-21 15:49:28 +00:00
|
|
|
### CMake Bug: Use PKG_CONFIG_PATH instead of CMAKE_PREFIX_PATH
|
|
|
|
# https://gitlab.kitware.com/cmake/cmake/issues/15805
|
2018-08-21 22:44:12 +00:00
|
|
|
# Note: If using PKG_CONFIG_PATH the variable needs to be set as exported
|
|
|
|
# in the execution environment.
|
2018-05-21 23:46:18 +00:00
|
|
|
pkg_get_variable(WIRESHARK_PLUGIN_DIR wireshark plugindir)
|
|
|
|
|
2018-08-21 15:49:28 +00:00
|
|
|
set(PLUGIN_INSTALL_LIBDIR "${WIRESHARK_PLUGIN_DIR}/epan")
|
|
|
|
|
2018-05-21 23:46:18 +00:00
|
|
|
include(CMakePushCheckState)
|
2018-08-21 15:49:28 +00:00
|
|
|
include(CheckFunctionExists)
|
2018-05-21 23:46:18 +00:00
|
|
|
|
|
|
|
cmake_push_check_state()
|
2018-08-21 15:49:28 +00:00
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${WIRESHARK_LDFLAGS})
|
|
|
|
check_function_exists("proto_register_plugin" HAVE_PROTO_REGISTER_PLUGIN)
|
2018-05-21 23:46:18 +00:00
|
|
|
cmake_pop_check_state()
|
|
|
|
if(NOT HAVE_PROTO_REGISTER_PLUGIN)
|
|
|
|
message(FATAL_ERROR "Wireshark was compiled without support for plugins")
|
|
|
|
endif()
|
|
|
|
|
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()
|
|
|
|
|
2018-08-21 14:18:56 +00:00
|
|
|
add_definitions(-DHAVE_PLUGINS -DVERSION=\"${PROJECT_VERSION}\")
|
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-21 15:49:28 +00:00
|
|
|
target_link_libraries(hello ${WIRESHARK_LDFLAGS})
|
2018-05-21 23:46:18 +00:00
|
|
|
target_compile_options(hello PUBLIC ${WIRESHARK_CFLAGS})
|
|
|
|
|
|
|
|
install(TARGETS hello
|
2018-08-21 15:49:28 +00:00
|
|
|
LIBRARY DESTINATION "${PLUGIN_INSTALL_LIBDIR}" NAMELINK_SKIP
|
2018-05-21 23:46:18 +00:00
|
|
|
)
|