File: FindPCAP.cmake

package info (click to toggle)
arpon 2.0-2.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 564 kB
  • sloc: ansic: 2,275; sh: 168; makefile: 141
file content (34 lines) | stat: -rw-r--r-- 1,299 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# FindPCAP search and find the libpcap library path
#
# The following variables are set:
# CMAKE_C_FLAGS - flags to add to the C compiler for build arpon
# CMAKE_INCLUDE - include path Cflag
# CMAKE_LIBS    - library path Cflag
#
# Copyright 2010 <Giuseppe Marco Randazzo> zeld@freaknet.org
#
# Redistribution AND use is allowed according to the terms of the New
# BSD license.

find_path(PCAP_INCLUDE_DIR ${libpcap_h} ${CMAKE_INCLUDE_PATH})

find_path(PCAP_LIB_DIR ${libpcap} ${CMAKE_LIBRARY_PATH})

find_library(PCAP_LIBRARY NAMES ${libpcap} PATH ${CMAKE_LIBRARY_PATH})

if(PCAP_INCLUDE_DIR AND PCAP_LIBRARY )
  message(STATUS "Found Libpcap.")

  if(NOT ${INCLUDE_DIR} MATCHES ${PCAP_INCLUDE_DIR})
    include_directories(${PCAP_INCLUDE_DIR})
    set(INCLUDE_DIR "${INCLUDE_DIR} ${PCAP_INCLUDE_DIR}")
  endif(NOT ${INCLUDE_DIR} MATCHES ${PCAP_INCLUDE_DIR})

  if(PCAP_LIB_DIR AND NOT ${LIB_DIR} MATCHES ${PCAP_LIB_DIR})
    link_directories(${PCAP_LIB_DIR})
    set(LIB_DIR "${LIB_DIR} ${PCAP_LIB_DIR}")
  endif(NOT ${LIB_DIR} MATCHES ${PCAP_LIB_DIR})

else(NOT PCAP_INCLUDE_DIR OR NOT PCAP_LIB_DIR OR NOT PCAP_LIBRARY)
  message(FATAL_ERROR " Libpcap not found! Please visit http://www.tcpdump.org/ or see in the arpon 'INSTALL' file.")
endif(PCAP_INCLUDE_DIR AND PCAP_LIB_DIR AND PCAP_LIBRARY)