Fix CMake checks of PCap functions, along with AirPCap
[metze/wireshark/wip.git] / cmake / modules / FindAIRPCAP.cmake
1 #
2 # - Find airpcap
3 # Find the native AIRPCAP includes and library
4 #
5 #  AIRPCAP_INCLUDE_DIRS - where to find pcap.h, etc.
6 #  AIRPCAP_LIBRARIES    - List of libraries when using pcap.
7 #  AIRPCAP_FOUND        - True if pcap found.
8
9 include( FindWSWinLibs )
10 FindWSWinLibs( "AirPcap" AIRPCAP_TMP_HINTS )
11 #message( STATUS "AIRPCAP TMP HINTS: ${AIRPCAP_TMP_HINTS}" )
12 FindWSWinLibs( "Airpcap_" AIRPCAP_HINTS "${AIRPCAP_TMP_HINTS}" )
13 #message( STATUS "AIRPCAP HINTS: ${AIRPCAP_HINTS}" )
14
15 find_path( AIRPCAP_INCLUDE_DIR
16   NAMES
17   airpcap.h
18   pcap.h
19   HINTS
20     "${AIRPCAP_HINTS}/include"
21 )
22
23 find_library( AIRPCAP_LIBRARY
24   NAMES
25     airpcap
26   HINTS
27     "${AIRPCAP_HINTS}/lib"
28 )
29
30
31 include( FindPackageHandleStandardArgs )
32 find_package_handle_standard_args( AIRPCAP DEFAULT_MSG AIRPCAP_INCLUDE_DIR AIRPCAP_LIBRARY )
33
34 if( AIRPCAP_FOUND )
35   set( AIRPCAP_INCLUDE_DIRS ${AIRPCAP_INCLUDE_DIR} )
36   set( AIRPCAP_LIBRARIES ${AIRPCAP_LIBRARY} )
37   set( HAVE_AIRPCAP 1)
38 else()
39   set( AIRPCAP_INCLUDE_DIRS )
40   set( AIRPCAP_LIBRARIES )
41   set( HAVE_AIRPCAP 0)
42 endif()
43
44 mark_as_advanced( AIRPCAP_LIBRARIES AIRPCAP_INCLUDE_DIRS )