summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindAIRPCAP.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
commite4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch)
tree68cb5ef9081156392f1dd62a00c6ccc1451b93df /cmake/modules/FindAIRPCAP.cmake
parentInitial commit. (diff)
downloadwireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz
wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/FindAIRPCAP.cmake')
-rw-r--r--cmake/modules/FindAIRPCAP.cmake61
1 files changed, 61 insertions, 0 deletions
diff --git a/cmake/modules/FindAIRPCAP.cmake b/cmake/modules/FindAIRPCAP.cmake
new file mode 100644
index 0000000..a606f96
--- /dev/null
+++ b/cmake/modules/FindAIRPCAP.cmake
@@ -0,0 +1,61 @@
+#
+# - Find airpcap
+# Find the native AIRPCAP includes and library
+#
+# AIRPCAP_INCLUDE_DIRS - where to find pcap.h, etc.
+# AIRPCAP_LIBRARIES - List of libraries when using pcap.
+# AIRPCAP_FOUND - True if pcap found.
+# AIRPCAP_DLL_DIR - (Windows) Path to the AirPcap DLL.
+# AIRPCAP_DLL - (Windows) Name of the AirPcap DLL.
+
+include( FindWSWinLibs )
+FindWSWinLibs( "AirPcap" AIRPCAP_TMP_HINTS )
+#message( STATUS "AIRPCAP TMP HINTS: ${AIRPCAP_TMP_HINTS}" )
+FindWSWinLibs( "Airpcap_" AIRPCAP_HINTS "${AIRPCAP_TMP_HINTS}" )
+#message( STATUS "AIRPCAP HINTS: ${AIRPCAP_HINTS}" )
+
+find_path( AIRPCAP_INCLUDE_DIR
+ NAMES
+ airpcap.h
+ pcap.h
+ HINTS
+ "${AIRPCAP_HINTS}/include"
+)
+
+find_library( AIRPCAP_LIBRARY
+ NAMES
+ airpcap
+ HINTS
+ "${AIRPCAP_HINTS}/lib"
+)
+
+
+include( FindPackageHandleStandardArgs )
+find_package_handle_standard_args( AIRPCAP DEFAULT_MSG AIRPCAP_LIBRARY AIRPCAP_INCLUDE_DIR )
+
+if( AIRPCAP_FOUND )
+ set( AIRPCAP_INCLUDE_DIRS ${AIRPCAP_INCLUDE_DIR} )
+ set( AIRPCAP_LIBRARIES ${AIRPCAP_LIBRARY} )
+ if(WIN32)
+ set ( _platform_subdir "x86" )
+ if( WIN32 AND "${WIRESHARK_TARGET_PLATFORM}" STREQUAL "win64" )
+ set ( _platform_subdir "x64" )
+ endif()
+
+ set ( AIRPCAP_DLL_DIR "${AIRPCAP_HINTS}/bin/${_platform_subdir}"
+ CACHE PATH "Path to AirPcap DLL"
+ )
+ set ( AIRPCAP_DLL airpcap.dll
+ # We're storing filenames only. Should we use STRING instead?
+ CACHE FILEPATH "AirPcap DLL file name"
+ )
+ mark_as_advanced( AIRPCAP_DLL_DIR AIRPCAP_DLL )
+ endif()
+else()
+ set( AIRPCAP_INCLUDE_DIRS )
+ set( AIRPCAP_LIBRARIES )
+ set( AIRPCAP_DLL_DIR )
+ set( AIRPCAP_DLLS )
+endif()
+
+mark_as_advanced( AIRPCAP_LIBRARIES AIRPCAP_INCLUDE_DIRS )