CMake: test for the presence of libpcap

This commit is contained in:
Matteo Cypriani 2013-05-21 14:19:22 -04:00
parent 0c6af63657
commit c667203c45
2 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,17 @@
# This module tries to find the pcap library and sets the following
# variables:
# PCAP_INCLUDE_DIR
# PCAP_LIBRARY
# PCAP_FOUND
# Search for the header file
find_path(PCAP_INCLUDE_DIR pcap.h
PATH_SUFFIXES include)
# Search for the library
find_library(PCAP_LIBRARY pcap
PATH_SUFFIXES lib)
# Did we find everything we need?
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Pcap DEFAULT_MSG
PCAP_LIBRARY PCAP_INCLUDE_DIR)

View File

@ -19,7 +19,16 @@ configure_file(
### Linked libraries ###
set(EXTRA_LIBS ${EXTRA_LIBS} pcap)
# Make sure the pcap library is installed
find_package(Pcap)
if (NOT PCAP_FOUND)
message(WARNING
"OwlPS Listener dependency missing: libPcap")
return()
endif()
include_directories(${PCAP_INCLUDE_DIRS})
set(EXTRA_LIBS ${EXTRA_LIBS} ${PCAP_LIBRARY})
if (OWLPS_LISTENER_USES_CONFIG_FILE)
if (CONFUSE_FOUND)