diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2018-08-23 22:03:28 +0100 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2018-08-25 18:07:21 +0000 |
commit | d0b97a420d557042938ac5d6bf075fcd84df9371 (patch) | |
tree | 4075a2072c60cf242d25b2706ce08ebd6f78750a /doc/plugins.example | |
parent | e75905a583432e8b20cecdde71c41d17cb781392 (diff) |
CMake: Modernize config-file package support
A CMake config-file package provides support for downstreams using
CMake and Wireshark libraries to easily configure the libwireshark
dependency with:
find_package(Wireshark CONFIG [REQUIRED])
target_link_libraries(foo epan)
The FindWireshark.cmake file is no longer needed.
See cmake-package(7) for more details on CMake's package system.
Change-Id: Ie8af1d44417a99dd08d37959f7b2ffca88572ec2
Reviewed-on: https://code.wireshark.org/review/29208
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'doc/plugins.example')
-rw-r--r-- | doc/plugins.example/CMakeLists.txt | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/doc/plugins.example/CMakeLists.txt b/doc/plugins.example/CMakeLists.txt index 23a7e8f713..244c22bd4d 100644 --- a/doc/plugins.example/CMakeLists.txt +++ b/doc/plugins.example/CMakeLists.txt @@ -12,25 +12,9 @@ cmake_policy(SET CMP0048 NEW) project(Hello VERSION 0.0.1 DESCRIPTION "Wireshark Hello Plugin" LANGUAGES C) -find_package(PkgConfig REQUIRED) +find_package(Wireshark CONFIG REQUIRED) -pkg_check_modules(WIRESHARK REQUIRED wireshark>=2.5) -### CMake Bug: Use PKG_CONFIG_PATH instead of CMAKE_PREFIX_PATH -# https://gitlab.kitware.com/cmake/cmake/issues/15805 -# Note: If using PKG_CONFIG_PATH the variable needs to be set as exported -# in the execution environment. -pkg_get_variable(WIRESHARK_PLUGIN_DIR wireshark plugindir) - -set(PLUGIN_INSTALL_LIBDIR "${WIRESHARK_PLUGIN_DIR}/epan") - -include(CMakePushCheckState) -include(CheckFunctionExists) - -cmake_push_check_state() -set(CMAKE_REQUIRED_LIBRARIES ${WIRESHARK_LDFLAGS}) -check_function_exists("proto_register_plugin" HAVE_PROTO_REGISTER_PLUGIN) -cmake_pop_check_state() -if(NOT HAVE_PROTO_REGISTER_PLUGIN) +if(NOT Wireshark_PLUGINS_ENABLED) message(FATAL_ERROR "Wireshark was compiled without support for plugins") endif() @@ -39,13 +23,12 @@ if (CMAKE_COMPILER_IS_GNUCC) set(CMAKE_C_FLAGS "-Wall -Wextra ${CMAKE_C_FLAGS}") endif() -add_definitions(-DHAVE_PLUGINS -DVERSION=\"${PROJECT_VERSION}\") +add_definitions(-DVERSION=\"${PROJECT_VERSION}\") add_library(hello MODULE hello.c) set_target_properties(hello PROPERTIES PREFIX "" DEFINE_SYMBOL "") -target_link_libraries(hello ${WIRESHARK_LDFLAGS}) -target_compile_options(hello PUBLIC ${WIRESHARK_CFLAGS}) +target_link_libraries(hello epan) install(TARGETS hello - LIBRARY DESTINATION "${PLUGIN_INSTALL_LIBDIR}" NAMELINK_SKIP + LIBRARY DESTINATION "${Wireshark_PLUGIN_INSTALL_DIR}/epan" NAMELINK_SKIP ) |