]> The Tcpdump Group git mirrors - tcpdump/blobdiff - cmake/Modules/FindPCAP.cmake
remove redundant ND_TCHECK, let GET_ routines handle checks
[tcpdump] / cmake / Modules / FindPCAP.cmake
index 6b0fbb6ede128a39549e4eb775b5f6f808c26be3..64d0901d126bf9d2300bf3d73b352de28e18fa75 100644 (file)
@@ -1,6 +1,12 @@
 #
 # Try to find libpcap.
 #
+# To tell this module where to look, a user may set the environment variable
+# PCAP_ROOT to point cmake to the *root* of a directory with include and
+# lib subdirectories for pcap.dll (e.g WpdPack or npcap-sdk).
+# Alternatively, PCAP_ROOT may also be set from cmake command line or GUI
+# (e.g cmake -DPCAP_ROOT=C:\path\to\pcap [...])
+#
 
 if(WIN32)
   #
@@ -36,7 +42,7 @@ if(WIN32)
     #
     set(CMAKE_LIBRARY_ARCHITECTURE "x64")
   endif()
-  find_library(PCAP_LIBRARY pcap wpcap)
+  find_library(PCAP_LIBRARY NAMES pcap wpcap)
 
   #
   # Do the standard arg processing, including failing if it's a
@@ -67,7 +73,7 @@ else(WIN32)
   # libpcap isn't available - not all systems ship pkg-config, and
   # libpcap didn't have .pc files until libpcap 1.9.0.
   #
-  if(PCAP_FIND_QUIET)
+  if(PCAP_FIND_QUIETLY)
     set(_quiet "QUIET")
   endif()
 
@@ -75,7 +81,7 @@ else(WIN32)
   # First, try pkg-config.
   #
   find_package(PkgConfig)
-  pkg_search_module(CONFIG_PCAP ${QUIET} libpcap)
+  pkg_search_module(CONFIG_PCAP ${_quiet} libpcap)
 
   if(NOT CONFIG_PCAP_FOUND)
     #
@@ -85,6 +91,11 @@ else(WIN32)
     if(PCAP_CONFIG)
       #
       # We have pcap-config; use it.
+      #
+      if(NOT "${_quiet}" STREQUAL "QUIET")
+        message(STATUS "Found pcap-config")
+      endif()
+
       #
       # if this is macOS or some other Darwin-based OS, check whether
       # it's the system-supplied one.
@@ -130,7 +141,7 @@ else(WIN32)
           endif()
         endif()
       endforeach()
-        
+
       #
       # Now, get the library directories and libraries for dynamic linking.
       #