Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

CMake: Add compile check to test for correct ZeroMQ C++ headers #530

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions configure/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ Please install cppzmq (https://github.com/zeromq/cppzmq) on your system and/or u
<OMNI_BASE>/include and system include directories).")
endif()

TRY_COMPILE(HAS_COMPATIBLE_ZMQ_HPP_VERSION
${CMAKE_BINARY_DIR}/configure
SOURCES ${CMAKE_SOURCE_DIR}/configure/test_zmq_hpp.cpp
CMAKE_FLAGS "-I ${CPPZMQ_BASE}/include -I ${ZMQ_PKG_INCLUDE_DIRS}/include"
LINK_LIBRARIES ${ZMQ_PKG_LIBRARIES})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to avoid ${ZMQ_PKG_XXX} here and use ${CPPZMQ_BASE} everywhere. As it is now - cmake compiles against cppzmq from pkg-config (from apt-get) which is indeed incompatible on Debian 9&7


IF(NOT HAS_COMPATIBLE_ZMQ_HPP_VERSION)
message(FATAL_ERROR "Please use a compatible version of cppzmq")
ENDIF()

message("Verifying ${OMNIIDL_PATH}omniidl")
if(WIN32)
execute_process(COMMAND ${OMNIIDL_PATH}omniidl.exe -V RESULT_VARIABLE FAILED)
Expand Down
10 changes: 10 additions & 0 deletions configure/test_zmq_hpp.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <zmq.hpp>

int main(int argc, char** argv)
{
zmq::context_t c;
zmq::socket_t s(c, ZMQ_REQ);

// we require `operator void*()`
void *ptr = s;
}