Fix CMake checks of PCap functions, along with AirPCap
[metze/wireshark/wip.git] / cmake / modules / FindPCAP.cmake
index 487a729318b9be5eaf2795d681f594293ef0f0c9..268b3e1a22b6983280dcd5469b8a7bd5da5795b3 100644 (file)
@@ -9,6 +9,12 @@
 include( FindWSWinLibs )
 FindWSWinLibs( "WpdPack" "PCAP_HINTS" )
 
+# The 64-bit wpcap.lib is under /x64
+set ( _PLATFORM_SUBDIR "" )
+if( WIN32 AND "$ENV{WIRESHARK_TARGET_PLATFORM}" MATCHES "64" )
+  set ( _PLATFORM_SUBDIR "/x64" )
+endif()
+
 find_path( PCAP_INCLUDE_DIR
   NAMES
   pcap/pcap.h
@@ -22,7 +28,7 @@ find_library( PCAP_LIBRARY
     pcap
     wpcap
   HINTS
-    "${PCAP_HINTS}/lib"
+    "${PCAP_HINTS}/lib${_PLATFORM_SUBDIR}"
 )
 
 
@@ -70,11 +76,12 @@ check_function_exists( "pcap_lib_version" HAVE_PCAP_LIB_VERSION )
 check_function_exists( "pcap_list_datalinks" HAVE_PCAP_LIST_DATALINKS )
 check_function_exists( "pcap_set_datalink" HAVE_PCAP_SET_DATALINK )
 check_function_exists( "bpf_image" HAVE_BPF_IMAGE )
+check_function_exists( "pcap_setsampling" HAVE_PCAP_SETSAMPLING )
 # Remote pcap checks
-check_function_exists( "pcap_open" H_PCAP_OPEN )
+check_function_exists( "pcap_open" HAVE_PCAP_OPEN )
 check_function_exists( "pcap_findalldevs_ex" H_FINDALLDEVS_EX )
 check_function_exists( "pcap_createsrcstr" H_CREATESRCSTR )
-if( H_PCAP_OPEN AND H_FINDALLDEVS_EX AND H_CREATESRCSTR )
+if( HAVE_PCAP_OPEN AND H_FINDALLDEVS_EX AND H_CREATESRCSTR )
   set( HAVE_PCAP_REMOTE 1 )
   set( HAVE_REMOTE 1 )
 endif()