Enable building ZeroMQ support on Windows

This commit is contained in:
Tim Wojtulewicz 2025-08-15 16:55:33 -07:00 committed by Tim Wojtulewicz
parent 5cc5f2a275
commit 4705537002
4 changed files with 16 additions and 8 deletions

View file

@ -7,5 +7,5 @@ call "c:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliar
mkdir build
cd build
cmake.exe .. -DCMAKE_BUILD_TYPE=release -DVCPKG_TARGET_TRIPLET="x64-windows-static" -DENABLE_ZEEK_UNIT_TESTS=yes -DENABLE_CLUSTER_BACKEND_ZEROMQ=no -G Ninja
cmake.exe .. -DCMAKE_BUILD_TYPE=release -DVCPKG_TARGET_TRIPLET="x64-windows-static" -DENABLE_ZEEK_UNIT_TESTS=yes -G Ninja
cmake.exe --build .

View file

@ -1,7 +1,3 @@
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),
@ -9,6 +5,14 @@ find_package(ZeroMQ)
option(ENABLE_CLUSTER_BACKEND_ZEROMQ "Enable the ZeroMQ cluster backend" ON)
if (ENABLE_CLUSTER_BACKEND_ZEROMQ)
if (MSVC)
find_package(ZeroMQ CONFIG REQUIRED)
else ()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/zeromq/cmake")
find_package(ZeroMQ REQUIRED)
endif ()
if (NOT ZeroMQ_FOUND)
message(FATAL_ERROR "ENABLE_CLUSTER_BACKEND_ZEROMQ set, but ZeroMQ library not available")
endif ()

View file

@ -1,6 +1,8 @@
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(ZeroMQ REQUIRED)
# On MSVC, ZeroMQ_LIBRARIES may not be set by find_package() earlier in the
# process. If it isn't, set it to the static target generated by vcpkg.
if (MSVC AND NOT ZeroMQ_LIBRARIES)
set(ZeroMQ_LIBRARIES libzmq-static)
endif ()
zeek_add_plugin(
Zeek Cluster_Backend_ZeroMQ

View file

@ -3,7 +3,9 @@
"version-string": "latest",
"dependencies": [
"c-ares",
"cppzmq",
"libpcap",
"zeromq",
"zlib"
]
}