pex-msg: fix siphash key initializer
[project/unetd.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.3)
2
3 PROJECT(unetd C)
4
5
6 SET(SOURCES
7 main.c network.c host.c service.c pex.c
8 wg.c wg-user.c
9 )
10
11 SET(RUNSTATEDIR /var/run)
12
13 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations -DRUNSTATEDIR="${RUNSTATEDIR}")
14 FIND_LIBRARY(libjson NAMES json-c json)
15
16 OPTION(UBUS_SUPPORT "enable ubus support" ON)
17 IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
18 FIND_LIBRARY(nl nl-tiny)
19 find_library(bpf NAMES bpf)
20 find_library(elf NAMES elf)
21 find_library(zlib NAMES z)
22 SET(SOURCES ${SOURCES} wg-linux.c vxlan.c bpf.c rtnl.c)
23 ELSE()
24 SET(nl "")
25 SET(bpf "")
26 SET(elf "")
27 SET(zlib "")
28 ENDIF()
29 IF(UBUS_SUPPORT)
30 SET(SOURCES ${SOURCES} ubus.c)
31 ADD_DEFINITIONS(-DUBUS_SUPPORT=1)
32 FIND_LIBRARY(ubus ubus)
33 ELSE()
34 SET(ubus "")
35 ENDIF()
36
37 ADD_LIBRARY(unet SHARED curve25519.c siphash.c sha512.c fprime.c f25519.c ed25519.c edsign.c auth-data.c chacha20.c pex-msg.c utils.c)
38 TARGET_LINK_LIBRARIES(unet ubox)
39
40 ADD_EXECUTABLE(unetd ${SOURCES})
41 TARGET_LINK_LIBRARIES(unetd unet ubox ${ubus} blobmsg_json ${libjson} ${nl} ${bpf} ${elf} ${zlib})
42
43 ADD_EXECUTABLE(unet-tool cli.c)
44 TARGET_LINK_LIBRARIES(unet-tool unet blobmsg_json ${libjson} ubox)
45
46 INSTALL(TARGETS unetd unet unet-tool
47 RUNTIME DESTINATION sbin
48 LIBRARY DESTINATION lib
49 )