summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-01-28 19:24:22 -0800
committerGuy Harris <guy@alum.mit.edu>2018-01-28 19:24:22 -0800
commit341b86339452ce9b948158e0198901475a104063 (patch)
treed7b0dda5b61d5e90cf269719c1f51ba4e8896b61 /cmake
parentbf8cae24c055be3aa77ed8e389ef7987dcb81fc1 (diff)
downloadtcpdump-341b86339452ce9b948158e0198901475a104063.tar.gz
Add support for PCAP_DLL_DIR as a hint on Windows.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/FindPCAP.cmake40
1 files changed, 30 insertions, 10 deletions
diff --git a/cmake/Modules/FindPCAP.cmake b/cmake/Modules/FindPCAP.cmake
index 63597a1e..5ce53d3c 100644
--- a/cmake/Modules/FindPCAP.cmake
+++ b/cmake/Modules/FindPCAP.cmake
@@ -4,8 +4,14 @@
find_program(PCAP_CONFIG pcap-config)
if(PCAP_CONFIG)
+ #
# We have pcap-config; use it.
+ # XXX - what if this is on Windows? If you're using, for example,
+ # MinGW, that might be the right thing to do, *if* pcap-config
+ # were made to work properly on Windows, but what about MSVC?
+ #
# First, get the include directory.
+ #
execute_process(COMMAND "${PCAP_CONFIG}" "--cflags"
RESULT_VARIABLE PCAP_CONFIG_RESULT
OUTPUT_VARIABLE PCAP_CONFIG_OUTPUT
@@ -92,18 +98,32 @@ if(PCAP_CONFIG)
find_library(PCAP_STATIC_LIBRARY pcap HINTS ${_pcap_static_library_dirs})
cmake_pop_check_state()
else(PCAP_CONFIG)
- # Try to find the header
- find_path(PCAP_INCLUDE_DIR pcap.h)
+ if(WIN32)
+ #
+ # On Windows, we support PCAP_DLL_DIR being set to the path of
+ # a directory containing an SDK for {whatever}Pcap.
+ # XXX - is there a CMake convention for "look for package XXX
+ # here"?
+ #
+ # Try to find the header
+ find_path(PCAP_INCLUDE_DIR pcap.h HINTS ${PCAP_DLL_DIR})
- # Try to find the library
- find_library(PCAP_LIBRARY pcap)
+ # Try to find the library
+ find_library(PCAP_LIBRARY pcap HINTS ${PCAP_DLL_DIR})
+ else(WIN32)
+ # Try to find the header
+ find_path(PCAP_INCLUDE_DIR pcap.h)
- # Try to find the static library (XXX - what about AIX?)
- include(CMakePushCheckState)
- cmake_push_check_state()
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
- find_library(PCAP_STATIC_LIBRARY pcap)
- cmake_pop_check_state()
+ # Try to find the library
+ find_library(PCAP_LIBRARY pcap)
+
+ # Try to find the static library (XXX - what about AIX?)
+ include(CMakePushCheckState)
+ cmake_push_check_state()
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
+ find_library(PCAP_STATIC_LIBRARY pcap)
+ cmake_pop_check_state()
+ endif(WIN32)
set(PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR})
set(PCAP_LIBRARIES ${PCAP_LIBRARY})