cmake: Add libzmq optional package support

This commit is contained in:
Hennadii Stepanov committed 2024-08-16 19:27:40 +01:00
1 parent ae7b39a0e1
commit d2fda82b49
3 files changed
+46

No files matched your search

+18
View File
@@ -116,6 +116,23 @@ if(WITH_MINIUPNPC)
find_package(MiniUPnPc MODULE REQUIRED)
endif()
option(WITH_ZMQ "Enable ZMQ notifications." OFF)
if(WITH_ZMQ)
if(VCPKG_TARGET_TRIPLET)
find_package(ZeroMQ CONFIG REQUIRED)
else()
# The ZeroMQ project has provided config files since v4.2.2.
# TODO: Switch to find_package(ZeroMQ) at some point in the future.
find_package(PkgConfig REQUIRED)
pkg_check_modules(libzmq REQUIRED IMPORTED_TARGET libzmq>=4)
# TODO: This command will be redundant once
# https://github.com/bitcoin/bitcoin/pull/30508 is merged.
target_link_libraries(PkgConfig::libzmq INTERFACE
$<$<PLATFORM_ID:Windows>:iphlpapi;ws2_32>
)
endif()
endif()
set(configure_warnings)
include(CheckPIESupported)
@@ -291,6 +308,7 @@ endif()
message(" port mapping:")
message(" - using NAT-PMP .................... ${WITH_NATPMP}")
message(" - using UPnP ....................... ${WITH_MINIUPNPC}")
message(" ZeroMQ .............................. ${WITH_ZMQ}")
message("Tests:")
message(" test_bitcoin ........................ ${BUILD_TESTS}")
message("")