Skip to content

Commit e848ef9

Browse files
ferdymercurydpiparo
authored andcommitted
[cmake] error out if ZeroMQ has no draft api support
Fixes #22300 (cherry picked from commit 4cbb376)
1 parent fdbcea3 commit e848ef9

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

cmake/modules/FindZeroMQ.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ find_library(ZeroMQ_LIBRARY
3737
set ( ZeroMQ_LIBRARIES ${ZeroMQ_LIBRARY} )
3838
set ( ZeroMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR} )
3939

40+
# check for zmq_ppoll
41+
if(ZeroMQ_LIBRARIES)
42+
include(CheckCXXSymbolExists)
43+
set(CMAKE_REQUIRED_LIBRARIES ${ZeroMQ_LIBRARIES})
44+
set(CMAKE_REQUIRED_INCLUDES ${ZeroMQ_INCLUDE_DIRS})
45+
set(CMAKE_REQUIRED_DEFINITIONS "-DZMQ_BUILD_DRAFT_API")
46+
check_cxx_symbol_exists(zmq_ppoll zmq.h ZeroMQ_HAS_PPOLL)
47+
if(NOT ZeroMQ_HAS_PPOLL)
48+
message(SEND_ERROR "ZeroMQ library was compiled without draft API support (-DENABLE_DRAFTS).")
49+
endif()
50+
unset(CMAKE_REQUIRED_LIBRARIES)
51+
unset(CMAKE_REQUIRED_INCLUDES)
52+
unset(CMAKE_REQUIRED_DEFINITIONS)
53+
endif()
54+
4055
include ( FindPackageHandleStandardArgs )
4156
# handle the QUIETLY and REQUIRED arguments and set ZeroMQ_FOUND to TRUE
4257
# if all listed variables are TRUE

0 commit comments

Comments
 (0)