cppzmq icon indicating copy to clipboard operation
cppzmq copied to clipboard

Build instructions for libzmq and cppzmq with draft apis

Open wynn4 opened this issue 5 years ago • 4 comments

Following the basic install instructions here: https://github.com/zeromq/cppzmq#build-instructions

Results in builds where the draft apis are not enabled. Looking into the CMakeLists.txt files, I thought that if I cloned the repositories (as opposed to downloading a .tar.gz from the release page) that the draft functions would be enabled.

From CMakeLists.txt:

if (EXISTS "${CMAKE_SOURCE_DIR}/.git") OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" ON) else () OPTION (ENABLE_DRAFTS "Build and install draft classes and methods" OFF) endif () if (ENABLE_DRAFTS) ADD_DEFINITIONS (-DZMQ_BUILD_DRAFT_API) set (pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1") else (ENABLE_DRAFTS) set (pkg_config_defines "") endif (ENABLE_DRAFTS)

Is there a simple change to these instructions that would change this? Specifically I'm hoping to use the cppzmq's poller functionality.

wynn4 avatar Oct 20 '20 18:10 wynn4

How are you consuming the libary, with CMake add_subdirectory or just including the headers or a package manager? But the simplest way is to just define ZMQ_BUILD_DRAFT_API in you project (assuming libzmq has it enabled also).

gummif avatar Oct 22 '20 21:10 gummif

Thanks @gummif. I'm installing both libraries following the instructions from the README linked above, then in my project's CMakeLists.txt I'm doing the following (as also suggested in the README):

#find cppzmq wrapper, installed by make of cppzmq    
find_package(cppzmq)  
target_link_libraries(*Your Project Name* cppzmq)

wynn4 avatar Oct 23 '20 00:10 wynn4

I think in this case you need to just define the macro yourself. But that could maybe be better documented as you said.

gummif avatar Oct 23 '20 11:10 gummif

I also have had hard time to build my program with zmq draft feature on Windows 10 / Visual Studio

It would be nice if #build-instructions mentions about ZMQ_BUILD_DRAFT_API

jaewooklee93 avatar Dec 18 '20 07:12 jaewooklee93