Complete cmake support for netlink detection

svn path=/trunk/; revision=43421
This commit is contained in:
Jörg Mayer 2012-06-20 20:59:43 +00:00
parent 49849233c3
commit c0da019caa
5 changed files with 63 additions and 0 deletions

View File

@ -312,6 +312,10 @@ if(ENABLE_GEOIP)
set(PACKAGELIST ${PACKAGELIST} GEOIP)
endif()
if(ENABLE_NETLINK)
set(PACKAGELIST ${PACKAGELIST} NL)
endif()
# Capabilities
if(ENABLE_CAP)
set(PACKAGELIST ${PACKAGELIST} CAP)
@ -380,6 +384,9 @@ endif()
if(ENABLE_AIRPCAP)
set(HAVE_AIRPCAP 1)
endif()
if(HAVE_LIBNL AND ENABLE_AIRPCAP)
message(ERROR "Airpcap and Libnl support are mutually exclusive")
endif()
# No matter which version of GTK is present
if(GTK2_FOUND OR GTK3_FOUND)
set(GTK_FOUND ON)
@ -904,6 +911,7 @@ if(BUILD_dumpcap AND PCAP_FOUND)
${GTHREAD2_LIBRARIES}
${ZLIB_LIBRARIES}
${APPLE_COCOA_LIBRARY}
${LIBNL_LIBRARIES}
)
set(dumpcap_FILES
svnversion.h

View File

@ -44,5 +44,6 @@ option(ENABLE_GCRYPT "Build with GNU crypto support" ON)
option(ENABLE_GEOIP "Build with GeoIP support" ON)
option(ENABLE_CAP "Build with posix capabilities support" ON)
option(ENABLE_CARES "Build with c_ares support" ON)
option(ENABLE_LIBNL "Build with libnl support" ON)
# todo Mostly hardcoded
option(ENABLE_KERBEROS "Build with Kerberos support" ON)

View File

@ -832,6 +832,7 @@ EXTRA_DIST = \
cmake/modules/FindGTK3.cmake \
cmake/modules/FindHtmlViewer.cmake \
cmake/modules/FindKERBEROS.cmake \
cmake/modules/FindLIBNL.cmake \
cmake/modules/FindLEX.cmake \
cmake/modules/FindLUA.cmake \
cmake/modules/FindLYNX.cmake \

View File

@ -0,0 +1,50 @@
#
# $Id$
#
# - Find libnl
# Find the native LIBNL includes and library
#
# LIBNL_INCLUDE_DIRS - where to find libnl.h, etc.
# LIBNL_LIBRARIES - List of libraries when using libnl3.
# LIBNL_FOUND - True if libnl found.
FIND_PATH(
LIBNL_INCLUDE_DIR
NAMES
netlink/netlink.h
PATHS
/opt/local/include
/sw/include
/usr/include
/usr/local/include
PATH_SUFFIXES
libnl3
)
SET(LIBNL_NAMES nl-3)
FIND_LIBRARY(LIBNL_LIBRARY NAMES ${LIBNL_NAMES} )
FIND_LIBRARY(LIBNLGENL_LIBRARY NAMES nl-genl-3 )
FIND_LIBRARY(LIBNLROUTE_LIBRARY NAMES nl-route-3 )
IF(NOT LIBNL_FOUND)
FIND_PATH(LIBNL_INCLUDE_DIR netlink/netlink.h /usr/include/)
SET(LIBNL_NAMES nl)
FIND_LIBRARY(LIBNL_LIBRARY NAMES ${LIBNL_NAMES} )
FIND_LIBRARY(LIBNLGENL_LIBRARY NAMES nl-genl )
FIND_LIBRARY(LIBNLROUTE_LIBRARY NAMES nl-route )
ENDIF()
# handle the QUIETLY and REQUIRED arguments and set LIBNL_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBNL DEFAULT_MSG LIBNL_LIBRARY LIBNL_INCLUDE_DIRS)
IF(LIBNL_FOUND)
SET( LIBNL_LIBRARIES ${LIBNL_LIBRARY} ${LIBNLGENL_LIBRARY} ${LIBNLROUTE_LIBRARY})
SET( LIBNL_INCLUDE_DIRS ${LIBNL_INCLUDE_DIR})
ELSE()
SET( LIBNL_LIBRARIES )
SET( LIBNL_INCLUDE_DIRS )
ENDIF()
MARK_AS_ADVANCED( LIBNL_LIBRARIES LIBNL_INCLUDE_DIRS )

View File

@ -60,6 +60,9 @@
/* Define to use the airpcap library */
#cmakedefine HAVE_AIRPCAP 1
/* Define to use the libnl library */
#cmakedefine HAVE_LIBNL 1
/* Define to use C ares library */
#cmakedefine HAVE_C_ARES 1