Added cmake tests for hiredis
hiredis is the official c client for the redis db. It is needed to create an Redis IPFIX exorter that can directly write to the flow-inspector (https://github.com/constcast/flow-inspector) input queue.master
parent
c5807b37f4
commit
cfa0f2a9d2
|
@ -101,7 +101,7 @@ OPTION(SUPPORT_MONGO "Enable MongoDB support" OFF)
|
|||
IF (SUPPORT_MONGO)
|
||||
FIND_PACKAGE(MONGO REQUIRED)
|
||||
IF (NOT MONGO_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Could not find MongoDB libraries.")
|
||||
MESSAGE(FATAL_ERROR "Could not find MongoDB libraries.")
|
||||
ENDIF (NOT MONGO_FOUND)
|
||||
ENDIF (SUPPORT_MONGO)
|
||||
IF (MONGO_FOUND)
|
||||
|
@ -132,6 +132,25 @@ ELSE (MONGO_FOUND)
|
|||
REMOVE_DEFINITIONS(-DBOOST_FILESYSTEM_VERSION)
|
||||
ENDIF (MONGO_FOUND)
|
||||
|
||||
### Redis
|
||||
|
||||
OPTION(SUPPORT_REDIS "Enable Redis support (for flow-inspector integration)" OFF)
|
||||
IF (SUPPORT_REDIS)
|
||||
FIND_PACKAGE(Redis REQUIRED)
|
||||
IF (NOT HIREDIS_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Could not find hiredis client libraries.")
|
||||
ENDIF (NOT HIREDIS_FOUND)
|
||||
ENDIF (SUPPORT_REDIS)
|
||||
IF (HIREDIS_FOUND)
|
||||
ADD_DEFINITIONS(-DREDIS_SUPPORT_ENABLED)
|
||||
INCLUDE_DIRECTORIES(${HIREDIS_INCLUDE_DIR})
|
||||
TARGET_LINK_LIBRARIES(vermont
|
||||
${HIREDIS_LIBRARIES}
|
||||
)
|
||||
ELSE (HIREDIS_FOUND)
|
||||
REMOVE_DEFINITIONS(-DREDIS_SUPPORT_ENABLED)
|
||||
ENDIF (HIREDIS_FOUND)
|
||||
|
||||
### boost
|
||||
|
||||
FIND_PACKAGE(Boost REQUIRED)
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
# - Find Redis client db (hiredis from https://github.com/antirez/hiredis)
|
||||
# Find the hiredis includes and client library
|
||||
# This module defines
|
||||
# HIREDIS_INCLUDE_DIR, where to find hiredis/hiredis.h
|
||||
# HIREDIS_LIBRARIES, the libraries needed to use redis.
|
||||
# HIREDIS_FOUND, If false, do not try to use redis.
|
||||
#
|
||||
# Copyright (c) 2012, Lothar Braun, <braun@net.in.tum.de>
|
||||
#
|
||||
|
||||
# Add the redis include paths here
|
||||
IF (HIREDIS_INCLUDE_DIR AND HIREDIS_LIBRARIES)
|
||||
SET (HIREDIS_FOUND TRUE)
|
||||
ELSE(HIREDIS_INCLUDE_DIR AND HIREDIS_LIBRARIES)
|
||||
FIND_PATH(HIREDIS_INCLUDE_DIR hiredis/hiredis.h
|
||||
/usr/include/
|
||||
/usr/include/hiredis
|
||||
/usr/local/include/
|
||||
/usr/local/include/hiredis
|
||||
/opt/local/include/
|
||||
/opt/local/include/hiredis
|
||||
)
|
||||
|
||||
FIND_LIBRARY(HIREDIS_LIBRARIES NAMES hiredis libhiredis
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
)
|
||||
|
||||
IF(HIREDIS_INCLUDE_DIR AND HIREDIS_LIBRARIES)
|
||||
SET(HIREDIS_FOUND TRUE)
|
||||
MESSAGE(STATUS "Found hiredis: ${HIREDIS_INCLUDE_DIR}, ${HIREDIS_LIBRARIES}")
|
||||
INCLUDE_DIRECTORIES(${HIREDIS_INCLUDE_DIR})
|
||||
ELSE(HIREDIS_INCLUDE_DIR AND HIREDIS_LIBRARIES)
|
||||
SET(HIREDIS_FOUND FALSE)
|
||||
MESSAGE(STATUS "hiredis client library not found.")
|
||||
ENDIF(HIREDIS_INCLUDE_DIR AND HIREDIS_LIBRARIES)
|
||||
|
||||
MARK_AS_ADVANCED(HIREDIS_INCLUDE_DIR HIREDIS_LIBRARIES)
|
||||
ENDIF(HIREDIS_INCLUDE_DIR AND HIREDIS_LIBRARIES)
|
Loading…
Reference in New Issue