mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
zeromq: Conditionally enable by default
Instead of having ZeroMQ as a new dependency, enable the ZeroMQ backend only if ZeroMQ is available on the system as suggested by Tim.
This commit is contained in:
parent
d816bfb249
commit
07e23fb95e
3 changed files with 18 additions and 9 deletions
|
@ -1,4 +1,17 @@
|
|||
option(ENABLE_CLUSTER_BACKEND_ZEROMQ "Enable the ZeroMQ cluster backend" ON)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/zeromq/cmake")
|
||||
|
||||
find_package(ZeroMQ)
|
||||
|
||||
# Default to building ZeroMQ only if ZeroMQ was found.
|
||||
#
|
||||
# If a user enabled the cluster backend explicitly (-D ENABLE_CLUSTER_BACKEND_ZEROMQ:bool=ON),
|
||||
# but ZeroMQ wasn' found, hard bail.
|
||||
option(ENABLE_CLUSTER_BACKEND_ZEROMQ "Enable the ZeroMQ cluster backend" ${ZeroMQ_FOUND})
|
||||
|
||||
if (ENABLE_CLUSTER_BACKEND_ZEROMQ)
|
||||
if (NOT ZeroMQ_FOUND)
|
||||
message(FATAL_ERROR "ENABLE_CLUSTER_BACKEND_ZEROMQ set, but ZeroMQ library not available")
|
||||
endif ()
|
||||
|
||||
add_subdirectory(zeromq)
|
||||
endif ()
|
||||
|
|
|
@ -2,8 +2,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|||
|
||||
find_package(ZeroMQ REQUIRED)
|
||||
|
||||
message(STATUS "zeromq: ${ZeroMQ_LIBRARIES} ${ZeroMQ_INCLUDE_DIRS}")
|
||||
|
||||
zeek_add_plugin(
|
||||
Zeek
|
||||
Cluster_Backend_ZeroMQ
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
set(AUXIL_CPPZMQ_DIR ${CMAKE_CURRENT_LIST_DIR}/../auxil/cppzmq)
|
||||
|
||||
find_library(ZeroMQ_LIBRARY NAMES zmq HINTS ${ZeroMQ_ROOT_DIR}/lib)
|
||||
|
||||
find_path(ZeroMQ_INCLUDE_DIR NAMES zmq.h HINTS ${ZeroMQ_ROOT_DIR}/include)
|
||||
|
@ -31,18 +33,14 @@ endif ()
|
|||
|
||||
if (NOT ZeroMQ_CPP_VERSION)
|
||||
# Probably no zmq.hpp file, use the version from auxil
|
||||
set(ZeroMQ_CPP_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/auxil/cppzmq"
|
||||
CACHE FILEPATH "Include path for cppzmq" FORCE)
|
||||
set(ZeroMQ_CPP_INCLUDE_DIR ${AUXIL_CPPZMQ_DIR} CACHE FILEPATH "Include path for cppzmq" FORCE)
|
||||
set_cppzmq_version()
|
||||
elseif (ZeroMQ_CPP_VERSION VERSION_LESS "4.9.0")
|
||||
message(STATUS "Found old cppzmq version ${ZeroMQ_CPP_VERSION}, using bundled version")
|
||||
set(ZeroMQ_CPP_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/auxil/cppzmq"
|
||||
CACHE FILEPATH "Include path for cppzmq" FORCE)
|
||||
set(ZeroMQ_CPP_INCLUDE_DIR ${AUXIL_CPPZMQ_DIR} CACHE FILEPATH "Include path for cppzmq" FORCE)
|
||||
set_cppzmq_version()
|
||||
endif ()
|
||||
|
||||
message(STATUS "Using cppzmq ${ZeroMQ_CPP_VERSION} from ${ZeroMQ_CPP_INCLUDE_DIR}")
|
||||
|
||||
find_package_handle_standard_args(
|
||||
ZeroMQ FOUND_VAR ZeroMQ_FOUND REQUIRED_VARS ZeroMQ_LIBRARY ZeroMQ_INCLUDE_DIR
|
||||
ZeroMQ_CPP_INCLUDE_DIR ZeroMQ_CPP_VERSION)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue