-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
98 lines (78 loc) · 2.41 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
88
89
90
91
92
93
94
95
96
97
98
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
SET(CMAKE_LEGACY_CYGWIN_WIN32 0)
SET(CMAKE_MACOSX_RPATH ON)
PROJECT(capone C)
SET(CPN_VERSION "0.0.1")
SET(CPN_PROTOCOL_VERSION "1")
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
SET(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${PROJECT_SOURCE_DIR}/cmake/)
FIND_PACKAGE(PkgConfig REQUIRED)
FIND_PACKAGE(ProtobufC REQUIRED)
FIND_PACKAGE(Threads REQUIRED)
PKG_CHECK_MODULES(SODIUM REQUIRED libsodium)
INCLUDE(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(sched_setaffinity HAVE_SCHED)
CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/include/config.h)
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include"
"${PROJECT_BINARY_DIR}/include")
INCLUDE_DIRECTORIES(SYSTEM
${PROTOBUFC_INCLUDE_DIRS}
${SODIUM_INCLUDE_DIRS})
LINK_DIRECTORIES(${SODIUM_LIBRARY_DIRS})
ADD_DEFINITIONS(-D_POSIX_C_SOURCE=200809L)
ADD_DEFINITIONS(-D_DEFAULT_SOURCE)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -pedantic -std=c89")
PROTOBUF_GENERATE_C(PROTO_SOURCES PROTO_HEADERS
include/capone/proto/capabilities.proto
include/capone/proto/capone.proto
include/capone/proto/core.proto
include/capone/proto/discovery.proto
include/capone/proto/encryption.proto
include/capone/proto/exec.proto
include/capone/proto/invoke.proto)
ADD_LIBRARY(capone SHARED
lib/acl.c
lib/buf.c
lib/caps.c
lib/cfg.c
lib/channel.c
lib/client.c
lib/common.c
lib/global.c
lib/list.c
lib/log.c
lib/opts.c
lib/protobuf.c
lib/server.c
lib/service.c
lib/session.c
lib/socket.c
lib/crypto/asymmetric.c
lib/crypto/hash.c
lib/crypto/sign.c
lib/crypto/symmetric.c
lib/services/capabilities.c
lib/services/exec.c
lib/services/invoke.c
lib/services/synergy.c
lib/services/xpra.c
${PROTO_SOURCES})
TARGET_LINK_LIBRARIES(capone
${SODIUM_LIBRARIES}
${PROTOBUFC_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})
ADD_EXECUTABLE(cpn-client cpn-client.c)
TARGET_LINK_LIBRARIES(cpn-client capone)
ADD_EXECUTABLE(cpn-derive cpn-derive.c)
TARGET_LINK_LIBRARIES(cpn-derive capone)
ADD_EXECUTABLE(cpn-discover cpn-discover.c)
TARGET_LINK_LIBRARIES(cpn-discover capone)
ADD_EXECUTABLE(cpn-genkey cpn-genkey.c)
TARGET_LINK_LIBRARIES(cpn-genkey capone)
ADD_EXECUTABLE(cpn-server cpn-server.c)
TARGET_LINK_LIBRARIES(cpn-server capone)
ADD_SUBDIRECTORY(test)