22 lines
746 B
CMake
22 lines
746 B
CMake
# Redis (hiredis)
|
|
option(FUN_WITH_REDIS "Enable Redis (hiredis) support" OFF)
|
|
set(HIREDIS_INCLUDE_DIRS "")
|
|
set(HIREDIS_LINK_LIBS "")
|
|
if(FUN_WITH_REDIS)
|
|
add_definitions(-DFUN_WITH_REDIS)
|
|
find_package(PkgConfig QUIET)
|
|
if(PKG_CONFIG_FOUND)
|
|
pkg_check_modules(HIREDIS QUIET hiredis)
|
|
endif()
|
|
if(HIREDIS_FOUND)
|
|
list(APPEND HIREDIS_INCLUDE_DIRS ${HIREDIS_INCLUDE_DIRS} ${HIREDIS_INCLUDE_DIRS})
|
|
list(APPEND HIREDIS_LINK_LIBS ${HIREDIS_LINK_LIBS} ${HIREDIS_LIBRARIES})
|
|
else()
|
|
find_library(HIREDIS_LIB hiredis)
|
|
if(HIREDIS_LIB)
|
|
list(APPEND HIREDIS_LINK_LIBS ${HIREDIS_LIB})
|
|
else()
|
|
message(FATAL_ERROR "hiredis not found. Install hiredis (dev headers) or disable FUN_WITH_REDIS.")
|
|
endif()
|
|
endif()
|
|
endif()
|