diff options
author | Maarten Bezemer <maarten.bezemer@gmail.com> | 2014-11-11 14:41:01 +0100 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2014-12-16 14:18:02 +0000 |
commit | ce687075f04a950f8fd95d6b517c11eb2ee9fa62 (patch) | |
tree | dc8c1ad29bc90842546dc31b7d0c660b72f236ef | |
parent | ec28d8755ba1b0fff1b07ac13c3264465e0eb635 (diff) | |
download | wireshark-ce687075f04a950f8fd95d6b517c11eb2ee9fa62.tar.gz |
Add cmake helper files for finding wireshark
These files make it possible to use the cmake command find_package(Wirehark) to obtain information about the wireshark installation.
Change-Id: I5af7c4e7b53b99cd473e04905a92bac267cd9b83
Reviewed-on: https://code.wireshark.org/review/5235
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | cmake/modules/FindWireshark.cmake | 25 | ||||
-rw-r--r-- | cmake/modules/WiresharkConfig.cmake.in | 12 | ||||
-rw-r--r-- | cmake/modules/WiresharkConfigVersion.cmake.in | 10 | ||||
-rw-r--r-- | debian/wireshark-dev.install | 1 |
5 files changed, 60 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index db1440c934..056596270a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1789,6 +1789,18 @@ CHECKAPI( ${WIRESHARK_SRC} ) +set(CMAKE_INSTALL_MODULES_DIR ${CMAKE_INSTALL_LIBDIR}/@CPACK_PACKAGE_NAME@) +configure_file("${CMAKE_MODULE_PATH}/WiresharkConfig.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfig.cmake" @ONLY) +configure_file("${CMAKE_MODULE_PATH}/WiresharkConfigVersion.cmake.in" "${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake" @ONLY) +install( + FILES + ${CMAKE_MODULE_PATH}/FindWireshark.cmake + ${CMAKE_BINARY_DIR}/WiresharkConfig.cmake + ${CMAKE_BINARY_DIR}/WiresharkConfigVersion.cmake + DESTINATION + ${CMAKE_INSTALL_MODULES_DIR} +) + if(DOC_DIR) message(STATUS "Docdir install: ${DOC_DIR}") INSTALL( diff --git a/cmake/modules/FindWireshark.cmake b/cmake/modules/FindWireshark.cmake new file mode 100644 index 0000000000..27259d3c3d --- /dev/null +++ b/cmake/modules/FindWireshark.cmake @@ -0,0 +1,25 @@ +# Locate the Wireshark library. +# +# This file is meant to be copied into projects that want to use Wireshark. +# It will search for WiresharkConfig.cmake, which ships with Wireshark +# and will provide up-to-date buildsystem changes. Thus there should not be +# any need to update FindWiresharkVc.cmake again after you integrated it into +# your project. +# +# This module defines the following variables: +# Wireshark_FOUND +# Wireshark_VERSION_MAJOR +# Wireshark_VERSION_MINOR +# Wireshark_VERSION_PATCH +# Wireshark_VERSION +# Wireshark_VERSION_STRING +# Wireshark_INSTALL_DIR +# Wireshark_PLUGIN_INSTALL_DIR +# Wireshark_LIB_DIR +# Wireshark_INCLUDE_DIR +# Wireshark_CMAKE_MODULES_DIR + +find_package(Wireshark ${Wireshark_FIND_VERSION} QUIET NO_MODULE PATHS $ENV{HOME} /opt/Wireshark) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WiresharkCONFIG_MODE) diff --git a/cmake/modules/WiresharkConfig.cmake.in b/cmake/modules/WiresharkConfig.cmake.in new file mode 100644 index 0000000000..a10baad960 --- /dev/null +++ b/cmake/modules/WiresharkConfig.cmake.in @@ -0,0 +1,12 @@ +set(Wireshark_MAJOR_VERSION "@PROJECT_MAJOR_VERSION@" ) +set(Wireshark_MINOR_VERSION "@PROJECT_MINOR_VERSION@" ) +set(Wireshark_PATCH_VERSION "@PROJECT_PATCH_VERSION@" ) +set(Wireshark_VERSION @PROJECT_MAJOR_VERSION@.@PROJECT_MINOR_VERSION@.@PROJECT_PATCH_VERSION@) +set(Wireshark_VERSION_STRING "@PROJECT_MAJOR_VERSION@.@PROJECT_MINOR_VERSION@.@PROJECT_PATCH_VERSION@") + +set(Wireshark_INSTALL_DIR "@CMAKE_INSTALL_PREFIX@") +set(Wireshark_PLUGIN_INSTALL_DIR "@PLUGIN_INSTALL_DIR@") + +set(Wireshark_LIB_DIR "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@") +set(Wireshark_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/wireshark") +set(Wireshark_CMAKE_MODULES_DIR "@CMAKE_INSTALL_MODULES_DIR@") diff --git a/cmake/modules/WiresharkConfigVersion.cmake.in b/cmake/modules/WiresharkConfigVersion.cmake.in new file mode 100644 index 0000000000..0aa3286904 --- /dev/null +++ b/cmake/modules/WiresharkConfigVersion.cmake.in @@ -0,0 +1,10 @@ +set(PACKAGE_VERSION @PROJECT_MAJOR_VERSION@.@PROJECT_MINOR_VERSION@.@PROJECT_PATCH_VERSION@) + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if("${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/debian/wireshark-dev.install b/debian/wireshark-dev.install index 145c8d0b79..728d1c682f 100644 --- a/debian/wireshark-dev.install +++ b/debian/wireshark-dev.install @@ -4,3 +4,4 @@ tools/asn2deb usr/bin tools/wireshark_be.py usr/share/pyshared tools/wireshark_gen.py usr/share/pyshared tools/asn2wrs.py usr/share/pyshared +usr/lib/*/wireshark/*.cmake
\ No newline at end of file |