-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZMQ_BUILD_DRAFT_API is not added to compiler definitions for cppzmq target when ENABLE_DRAFTS is ON. #477
Comments
@melton1968 the CMake seems to check for a .git folder in the root directory and if it exists enable building the draft api support. I ran x86 build and also arm cross compiled cppzmq 4.6.0 and libzmq 4.3.2 a few weeks ago. I’m pretty sure I didn’t need any special flags. I support another target platform where I believe I used the compiler definitions as it was building from tar.gz sources rather than git clones. I will try to check that and let you know which flags I used, or the build system uses. Once you get the libraries compiled you still need to define the enable draft api’s #define before including zmq.hpp in your application otherwise the draft api code will not be exposed. |
I am using cppzmq in-source via CMake's FetchContent facilities and run into this problem as well. Rather than having to remember to define ZMQ_BUILD_DRAFT_API at higher levels, I think it should be put here as a target_compile_definition. The fix that gets me going is:
I'm sure there's better options to support use for installed versions and in-tree versions but this should serve as a rough guide. |
Isn't this something that needs to be fixed in libzmq, since that is where ZMQ_BUILD_DRAFT_API should be defined? Does libzmq export this definition in it's cmake files? |
"Isn't this something that needs to be fixed in libzmq" Yes. Quite right. Hadn't noticed that if using zmq.h you would also need this. |
Since zeromq/libzmq#4323 is merged, I guess all the |
This option added ZMQ_BUILD_DRAFT_API to the compile definitions. However, this should be propagated by libzmq (see zeromq/libzmq#4323 and zeromq#477). Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
This option added ZMQ_BUILD_DRAFT_API to the compile definitions. However, this should be propagated by libzmq (see zeromq/libzmq#4323 and zeromq#477). Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
When I run
cmake
to configurecppzmq
with the-DENALBE_DRAFTS=ON
flag and then build and install thecppzmq
target, the correspondingcppzmqTargets.cmake
configuration file does not set the-DZMQ_BUILD_DRAFT_API
compiler option as expected.The code in
CMakeLists.txt
looks correct:If I move that code block to below where the
cppzmq
target is defined and change theadd_definitions
method totarget_compile_definitions
:then
ZMQ_BUILD_DRAFT_API
correctly gets defined as a compiler option in the installed configuration files.I am not a
cmake
expert, so I am uncertain if there is something I am missing, but this seems to be some type of adverse interaction betweenadd_definitions
and interface targets.I am using
cmake
3.19.4.I can offer a pull request with the fix if that is useful.
The text was updated successfully, but these errors were encountered: