]> The Tcpdump Group git mirrors - libpcap/blob - cmake/Modules/FindAirPcap.cmake
Support AirPcap devices with a pcap module.
[libpcap] / cmake / Modules / FindAirPcap.cmake
1 #
2 # FindAirPcap
3 # ==========
4 #
5 # Find the AirPcap library and include files.
6 #
7 # This module defines the following variables:
8 #
9 # AIRPCAP_INCLUDE_DIR - absolute path to the directory containing airpcap.h.
10 #
11 # AIRPCAP_LIBRARY - relative or absolute path to the AirPcap library to
12 # link with. An absolute path is will be used if the
13 # AirPcap library is not located in the compiler's
14 # default search path.
15
16 # AIRPCAP_FOUND - TRUE if the AirPcap library *and* header are found.
17 #
18 # Hints and Backward Compatibility
19 # ================================
20 #
21 # To tell this module where to look, a user may set the environment variable
22 # AirPcap_ROOT to point cmake to the *root* of a directory with include and
23 # lib subdirectories for airpcap.dll (e.g Airpcap_Devpack).
24 # Alternatively, AirPcap_ROOT may also be set from the CMake command
25 # line or GUI (e.g cmake -DAirPcap_ROOT=C:\path\to\airpcap_sdk [...])
26 #
27
28 # The 64-bit airpcap.lib is located under /x64
29 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
30 #
31 # For the WinPcap and Npcap SDKs, the Lib subdirectory of the top-level
32 # directory contains 32-bit libraries; the 64-bit libraries are in the
33 # Lib/x64 directory.
34 #
35 # The only way to *FORCE* CMake to look in the Lib/x64 directory
36 # without searching in the Lib directory first appears to be to set
37 # CMAKE_LIBRARY_ARCHITECTURE to "x64".
38 #
39 # In newer versions of CMake, CMAKE_LIBRARY_ARCHITECTURE is set according to
40 # the language, e.g., CMAKE_<LANG>_LIBRARY_ARCHITECTURE. So, set the new
41 # variable, CMAKE_C_LIBRARY_ARCHITECTURE, so that CMAKE_LIBRARY_ARCHITECTURE
42 # inherits the correct value.
43 #
44 set(CMAKE_C_LIBRARY_ARCHITECTURE "x64")
45 set(CMAKE_LIBRARY_ARCHITECTURE "x64")
46 endif()
47
48 # Find the header
49 find_path(AIRPCAP_INCLUDE_DIR airpcap.h
50 PATH_SUFFIXES include
51 )
52
53 # Find the library
54 find_library(AIRPCAP_LIBRARY
55 NAMES airpcap
56 )
57
58 # Set AIRPCAP_FOUND to TRUE if AIRPCAP_INCLUDE_DIR and AIRPCAP_LIBRARY are TRUE.
59 include(FindPackageHandleStandardArgs)
60 find_package_handle_standard_args(AIRPCAP
61 DEFAULT_MSG
62 AIRPCAP_INCLUDE_DIR
63 AIRPCAP_LIBRARY
64 )
65
66 mark_as_advanced(AIRPCAP_INCLUDE_DIR AIRPCAP_LIBRARY)
67
68 set(AIRPCAP_INCLUDE_DIRS ${AIRPCAP_INCLUDE_DIR})
69 set(AIRPCAP_LIBRARIES ${AIRPCAP_LIBRARY})