diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-01-28 19:42:47 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-01-28 19:42:47 -0800 |
commit | c766e8cfad5738809690cdb39209b6459aa871d5 (patch) | |
tree | 2b9bff4c535b28983cab29dc607235149cc579ce /cmake | |
parent | 341b86339452ce9b948158e0198901475a104063 (diff) | |
download | tcpdump-c766e8cfad5738809690cdb39209b6459aa871d5.tar.gz |
On Windows, if we don't find libpcap, look for libwpcap.
Also, while there may not be a convention for "look for package XXX
here", there is a convention for "look for stuff here" - put "here" in
CMAKE_PREFIX_PATH. So don't use PCAP_DLL_DIR, just let find_path() and
find_library() search where you tell it (on Windows *or* UN*X).
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/FindPCAP.cmake | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/cmake/Modules/FindPCAP.cmake b/cmake/Modules/FindPCAP.cmake index 5ce53d3c..93b8db66 100644 --- a/cmake/Modules/FindPCAP.cmake +++ b/cmake/Modules/FindPCAP.cmake @@ -98,32 +98,27 @@ if(PCAP_CONFIG) find_library(PCAP_STATIC_LIBRARY pcap HINTS ${_pcap_static_library_dirs}) cmake_pop_check_state() else(PCAP_CONFIG) - 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 HINTS ${PCAP_DLL_DIR}) - else(WIN32) - # Try to find the header - find_path(PCAP_INCLUDE_DIR pcap.h) - - # Try to find the library - find_library(PCAP_LIBRARY pcap) + # Try to find the header + find_path(PCAP_INCLUDE_DIR pcap.h) + # Try to find the library + find_library(PCAP_LIBRARY pcap) + if(WIN32) + if(NOT PCAP_LIBRARY) + # + # OK, look for it under the name wpcap. + # + find_library(PCAP_LIBRARY wpcap) + endif(NOT PCAP_LIBRARY) + endif(WIN32) + if(NOT WIN32) # 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) + endif(NOTWIN32) set(PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR}) set(PCAP_LIBRARIES ${PCAP_LIBRARY}) |