diff options
author | Jörg Mayer <jmayer@loplof.de> | 2006-10-26 15:36:50 +0000 |
---|---|---|
committer | Jörg Mayer <jmayer@loplof.de> | 2006-10-26 15:36:50 +0000 |
commit | c1684fbf44748cf71bb2d76fe14ed3b0feba0b5f (patch) | |
tree | 09a1a1f826bd39af2474a7380aea16d31715ee4e /cmake/modules/FindPCAP.cmake | |
parent | 6cd3bd1202c3ff220ad4162542eb371aec76a59c (diff) |
frederic.heem:
Update/Add FindPCAP.cmake CMakeInstallDirs.cmake CMakeLists.txt
me:
Fix a typo, change gcc flags to mimic the behaviour of autofoo
stuff.
svn path=/trunk/; revision=19707
Diffstat (limited to 'cmake/modules/FindPCAP.cmake')
-rw-r--r-- | cmake/modules/FindPCAP.cmake | 59 |
1 files changed, 48 insertions, 11 deletions
diff --git a/cmake/modules/FindPCAP.cmake b/cmake/modules/FindPCAP.cmake index bd0da85eff..fbbaf62eac 100644 --- a/cmake/modules/FindPCAP.cmake +++ b/cmake/modules/FindPCAP.cmake @@ -1,26 +1,63 @@ # - Find pcap # Find the PCAP includes and library +# http://www.tcpdump.org/ # +# The environment variable PCAPDIR allows to specficy where to find +# libpcap in non standard location. +# # PCAP_INCLUDE_DIRS - where to find pcap.h, etc. # PCAP_LIBRARIES - List of libraries when using pcap. # PCAP_FOUND - True if pcap found. -#Includes -FIND_PATH(PCAP_INCLUDE_DIR pcap.h - /usr/local/include - /usr/include -) -SET(PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR}) +IF(EXISTS $ENV{PCAPDIR}) + FIND_PATH(PCAP_INCLUDE_DIR + NAMES + pcap/pcap.h + pcap.h + PATHS + $ENV{PCAPDIR} + NO_DEFAULT_PATH + ) + + FIND_LIBRARY(PCAP_LIBRARY + NAMES + pcap + PATHS + $ENV{PCAPDIR} + NO_DEFAULT_PATH + ) + -#Library -FIND_LIBRARY(PCAP_LIBRARY - NAMES pcap - PATHS /usr/lib /usr/local/lib -) +ELSE(EXISTS $ENV{PCAPDIR}) + FIND_PATH(PCAP_INCLUDE_DIR + NAMES + pcap/pcap.h + pcap.h + ) + + FIND_LIBRARY(PCAP_LIBRARY + NAMES + pcap + ) + +ENDIF(EXISTS $ENV{PCAPDIR}) +SET(PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR}) SET(PCAP_LIBRARIES ${PCAP_LIBRARY}) +IF(PCAP_INCLUDE_DIRS) + MESSAGE(STATUS "Pcap include dirs set to ${PCAP_INCLUDE_DIRS}") +ELSE(PCAP_INCLUDE_DIRS) + MESSAGE(FATAL " Pcap include dirs cannot be found") +ENDIF(PCAP_INCLUDE_DIRS) + +IF(PCAP_LIBRARIES) + MESSAGE(STATUS "Pcap library set to ${PCAP_LIBRARIES}") +ELSE(PCAP_LIBRARIES) + MESSAGE(FATAL "Pcap library cannot be found") +ENDIF(PCAP_LIBRARIES) + #Functions INCLUDE(CheckFunctionExists) SET(CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS}) |