46 lines
1.8 KiB
Diff
46 lines
1.8 KiB
Diff
|
From 1799b24aa397e98f7c894d17b37c087f1ae29d95 Mon Sep 17 00:00:00 2001
|
|||
|
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
|||
|
Date: Mon, 22 Apr 2019 18:40:25 +0200
|
|||
|
Subject: [PATCH] FindPCAP: use pkg-config to find pcap dependencies
|
|||
|
|
|||
|
On UNIX, when statically built, pcap can depends on other libraries such
|
|||
|
as -lnl-3. Add a call to pkg-config to find them and append them to
|
|||
|
PCAP_LIBRARIES (and so to CMAKE_REQUIRED_LIBRARIES) otherwise all
|
|||
|
check_function_exists calls will fail
|
|||
|
|
|||
|
Change-Id: I98361c05553738d015310fae76c17dfc08e131ff
|
|||
|
Ping-Bug: 15713
|
|||
|
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
|||
|
Reviewed-on: https://code.wireshark.org/review/32946
|
|||
|
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
|
|||
|
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
|
|||
|
Tested-by: Petri Dish Buildbot
|
|||
|
Reviewed-by: Guy Harris <guy@alum.mit.edu>
|
|||
|
[Retrieved from:
|
|||
|
https://github.com/wireshark/wireshark/commit/1799b24aa397e98f7c894d17b37c087f1ae29d95]
|
|||
|
---
|
|||
|
cmake/modules/FindPCAP.cmake | 10 ++++++++++
|
|||
|
1 file changed, 10 insertions(+)
|
|||
|
|
|||
|
diff --git a/cmake/modules/FindPCAP.cmake b/cmake/modules/FindPCAP.cmake
|
|||
|
index dfd80415f6..6fe2d0f4dc 100644
|
|||
|
--- a/cmake/modules/FindPCAP.cmake
|
|||
|
+++ b/cmake/modules/FindPCAP.cmake
|
|||
|
@@ -38,6 +38,16 @@ find_package_handle_standard_args( PCAP DEFAULT_MSG PCAP_LIBRARY PCAP_INCLUDE_DI
|
|||
|
if( PCAP_FOUND )
|
|||
|
set( PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR} )
|
|||
|
set( PCAP_LIBRARIES ${PCAP_LIBRARY} )
|
|||
|
+
|
|||
|
+ # Include transitive dependencies for static linking.
|
|||
|
+ # This requires:
|
|||
|
+ # 1) a system with pkg-config installed
|
|||
|
+ # 2) libpcap >= 1.9.0 with its .pc files installed
|
|||
|
+ if( UNIX AND CMAKE_FIND_LIBRARY_SUFFIXES STREQUAL ".a" )
|
|||
|
+ find_package( PkgConfig )
|
|||
|
+ pkg_search_module( PC_LIBPCAP libpcap )
|
|||
|
+ list( APPEND PCAP_LIBRARIES ${PC_LIBPCAP_LIBRARIES} )
|
|||
|
+ endif()
|
|||
|
else()
|
|||
|
set( PCAP_INCLUDE_DIRS )
|
|||
|
set( PCAP_LIBRARIES )
|