CMake: test for the presence of Confuse
This commit is contained in:
parent
8e46aae55c
commit
0c6af63657
|
@ -18,13 +18,21 @@ include_directories("${GENERATED_INCLUDE}")
|
|||
# Note: we test here the dependencies relevant for more than one module;
|
||||
# other tests are done in each module's directory.
|
||||
|
||||
# Add cmake/Modules to the molude path so that CMake can find the
|
||||
# additional FindXXX modules we (unfortunately have to) ship
|
||||
set(CMAKE_MODULE_PATH
|
||||
${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
|
||||
|
||||
# Check if we've got POSIX threads
|
||||
set(CMAKE_THREAD_PREFER_PTHREAD on)
|
||||
find_package(Threads)
|
||||
if (CMAKE_THREAD_LIBS_INIT AND CMAKE_USE_PTHREADS_INIT)
|
||||
set(HAVE_PTHREADS on)
|
||||
set(HAVE_PTHREADS true)
|
||||
endif()
|
||||
|
||||
# Check if we've got the Confuse library
|
||||
find_package(Confuse)
|
||||
|
||||
|
||||
### OwlPS' version ###
|
||||
|
||||
|
@ -120,15 +128,28 @@ include_directories(libowlps-resultreader)
|
|||
|
||||
### Programs targets ###
|
||||
|
||||
if (HAVE_PTHREADS)
|
||||
## Aggregator ##
|
||||
|
||||
if (HAVE_PTHREADS AND CONFUSE_FOUND)
|
||||
add_subdirectory(owlps-aggregator)
|
||||
else()
|
||||
message(WARNING
|
||||
"POSIX threads are not available, OwlPS Aggregator will not be built")
|
||||
|
||||
else() # Warn the user about missing dependencies
|
||||
if (NOT HAVE_PTHREADS)
|
||||
message(WARNING
|
||||
"OwlPS Aggregator dependency missing: POSIX threads")
|
||||
endif()
|
||||
if (NOT CONFUSE_FOUND)
|
||||
message(WARNING
|
||||
"OwlPS Aggregator dependency missing: libConfuse")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
## Client ##
|
||||
|
||||
add_subdirectory(owlps-client)
|
||||
|
||||
## Listener ##
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL Linux)
|
||||
add_subdirectory(owlps-listener)
|
||||
else()
|
||||
|
@ -136,6 +157,8 @@ else()
|
|||
"OwlPS Listener can be built only for Linux systems")
|
||||
endif()
|
||||
|
||||
## Positioner ##
|
||||
|
||||
# OwlPS Positioner can be built only with GCC, and with a minimal
|
||||
# version. CMAKE_CXX_COMPILER_VERSION is not guaranteed to be set,
|
||||
# so we will test GCC's version number only if possible.
|
||||
|
@ -158,11 +181,14 @@ else() # we're not using GCC
|
|||
"OwlPS Positioner requires GCC (>= ${POSITIONER_MIN_GCC_VERSION})")
|
||||
endif()
|
||||
|
||||
## UDP-to-HTTP ##
|
||||
|
||||
if (HAVE_PTHREADS)
|
||||
add_subdirectory(owlps-udp-to-http)
|
||||
else()
|
||||
|
||||
else() # Warn the user about missing dependencies
|
||||
message(WARNING
|
||||
"POSIX threads are not available, OwlPS UDP-to-HTTP will not be built")
|
||||
"OwlPS UDP-to-HTTP dependency missing: POSIX threads")
|
||||
endif()
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# This module tries to find the Confuse library and sets the following
|
||||
# variables:
|
||||
# CONFUSE_INCLUDE_DIR
|
||||
# CONFUSE_LIBRARY
|
||||
# CONFUSE_FOUND
|
||||
|
||||
# Search for the header file
|
||||
find_path(CONFUSE_INCLUDE_DIR confuse.h
|
||||
PATH_SUFFIXES include)
|
||||
|
||||
# Search for the library
|
||||
find_library(CONFUSE_LIBRARY confuse
|
||||
PATH_SUFFIXES lib)
|
||||
|
||||
# Did we find everything we need?
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Confuse DEFAULT_MSG
|
||||
CONFUSE_LIBRARY CONFUSE_INCLUDE_DIR)
|
|
@ -1,4 +1,5 @@
|
|||
set(EXTRA_LIBS ${EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT} confuse)
|
||||
include_directories(${CONFUSE_INCLUDE_DIR})
|
||||
set(EXTRA_LIBS ${EXTRA_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${CONFUSE_LIBRARY})
|
||||
|
||||
add_executable(owlps-aggregatord owlps-aggregatord.c)
|
||||
target_link_libraries(owlps-aggregatord
|
||||
|
|
|
@ -22,7 +22,15 @@ configure_file(
|
|||
set(EXTRA_LIBS ${EXTRA_LIBS} pcap)
|
||||
|
||||
if (OWLPS_LISTENER_USES_CONFIG_FILE)
|
||||
set(EXTRA_LIBS ${EXTRA_LIBS} confuse)
|
||||
if (CONFUSE_FOUND)
|
||||
include_directories(${CONFUSE_INCLUDE_DIR})
|
||||
set(EXTRA_LIBS ${EXTRA_LIBS} ${CONFUSE_LIBRARY})
|
||||
else()
|
||||
message(WARNING
|
||||
"Confuse is not available: disabling OWLPS_LISTENER_USES_CONFIG_FILE")
|
||||
set(OWLPS_LISTENER_USES_CONFIG_FILE off CACHE BOOL
|
||||
"No libConfuse: disable OWLPS_LISTENER_USES_CONFIG_FILE" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (OWLPS_LISTENER_USES_PTHREAD)
|
||||
|
|
Loading…
Reference in New Issue