forked from ElektraInitiative/libelektra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
46 lines (39 loc) · 1.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
include (LibAddBinding)
if (DEPENDENCY_PHASE)
find_package (ZeroMQ QUIET)
if (NOT ZeroMQ_FOUND)
remove_plugin (zeromqrecv "package libzmq (libzmq3-dev) not found")
endif ()
endif ()
add_plugin (
zeromqrecv
SOURCES zeromqrecv.h zeromqrecv.c subscribe.c
OBJECT_SOURCES $<TARGET_OBJECTS:io-adapter-zeromq>
INCLUDE_DIRECTORIES ${ZeroMQ_INCLUDE_DIR}
LINK_ELEKTRA elektra-io
LINK_LIBRARIES ${ZeroMQ_LIBRARIES} COMPONENT libelektra${SO_VERSION}-zeromq)
if (ADDTESTING_PHASE)
check_binding_was_added ("io_uv" IS_INCLUDED)
if (BUILD_TESTING AND IS_INCLUDED)
find_package (libuv QUIET) # libuv is present; otherwise io_uv bindings would not be added
if (BUILD_FULL OR BUILD_STATIC)
set (STATIC_LIBRARIES ${libuv_LIBRARIES})
endif ()
add_plugintest (
zeromqrecv
TEST_LINK_LIBRARIES ${STATIC_LIBRARIES}
TEST_LINK_ELEKTRA elektra-io-uv
INCLUDE_SYSTEM_DIRECTORIES ${libuv_INCLUDE_DIRS})
if (libuv_VERSION VERSION_LESS "1.0")
target_compile_definitions (testmod_zeromqrecv PRIVATE "HAVE_LIBUV0")
else ()
target_compile_definitions (testmod_zeromqrecv PRIVATE "HAVE_LIBUV1")
endif ()
# add sources manually because add_plugintest does not support generator expressions for additional source files
if (BUILD_FULL OR BUILD_STATIC) # add sources for elektra-io-uv for static and full builds
target_sources (testmod_zeromqrecv PRIVATE $<TARGET_OBJECTS:elektra-io-uv-objects>)
endif ()
else ()
message (WARNING "io_uv bindings are required for testing, test deactivated")
endif ()
endif ()