-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
87 lines (72 loc) · 3.2 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
cmake_minimum_required(VERSION 2.8.6)
project (sherpa-communication-mediator)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(INSTALL_DIR /usr/lib CACHE PATH "Installation directory for mediator")
########################################################################
# LIBZMQ dependency
########################################################################
find_package(libzmq REQUIRED)
IF (LIBZMQ_FOUND)
include_directories(${LIBZMQ_INCLUDE_DIRS})
list(APPEND LIBS ${LIBZMQ_LIBRARIES})
ELSE (LIBZMQ_FOUND)
message( FATAL_ERROR "libzmq not found." )
ENDIF (LIBZMQ_FOUND)
########################################################################
# CZMQ dependency
########################################################################
find_package(czmq REQUIRED)
IF (CZMQ_FOUND)
include_directories(${CZMQ_INCLUDE_DIRS})
list(APPEND LIBS ${CZMQ_LIBRARIES})
ELSE (CZMQ_FOUND)
message( FATAL_ERROR "czmq not found." )
ENDIF (CZMQ_FOUND)
########################################################################
# Zyre dependency
########################################################################
find_package(zyre REQUIRED)
IF (ZYRE_FOUND)
include_directories(${ZYRE_INCLUDE_DIRS})
list(APPEND LIBS ${ZYRE_LIBRARIES})
ELSE (ZYRE_FOUND)
message( FATAL_ERROR "zyre not found." )
ENDIF (ZYRE_FOUND)
########################################################################
# Jansson dependency
########################################################################
find_package(jansson REQUIRED)
IF (JANSSON_FOUND)
include_directories(${JANSSON_INCLUDE_DIRS})
list(APPEND LIBS ${JANSSON_LIBRARIES})
ELSE (JANSSON_FOUND)
message( FATAL_ERROR "JANSSON not found." )
ENDIF (JANSSON_FOUND)
########################################################################
# Mediator
########################################################################
include_directories(${PROJECT_SOURCE_DIR}/include)
set(HEADER_FILES ${PROJECT_SOURCE_DIR}/include/mediator.h)
#add_library(sherpa_comm_mediator SHARED ${PROJECT_SOURCE_DIR}/src/sherpa_comm_mediator.c)
add_executable(sherpa_comm_mediator ${PROJECT_SOURCE_DIR}/src/sherpa_comm_mediator.c ${HEADER_FILES})
target_link_libraries(sherpa_comm_mediator ${LIBS})
install(TARGETS sherpa_comm_mediator DESTINATION ${INSTALL_DIR})
## Test executable ##
enable_testing()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
set(CMAKE_CTEST_COMMAND ctest -V)
set_target_properties(check
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/test"
)
add_executable(mediator_selftest EXCLUDE_FROM_ALL ${PROJECT_SOURCE_DIR}/test/mediator_selftest.c ${HEADER_FILES})
target_link_libraries(mediator_selftest ${LIBS})
add_test(mediator_selftest ${PROJECT_SOURCE_DIR}/bin/mediator_selftest ${PROJECT_SOURCE_DIR}/examples/configs/donkey.json)
add_dependencies(check mediator_selftest)
# gcc -ggdb $< -lczmq -lzmq - -ljansson -o $@
# File transfer example binary
add_executable(file_transfer ${PROJECT_SOURCE_DIR}/examples/file_transfer/file_transfer_example.c ${HEADER_FILES})
target_link_libraries(file_transfer ${LIBS})