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