mss-bpf: remove unused-but-set variable
[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 utils.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 SET(SOURCES ${SOURCES} wg-linux.c vxlan.c bpf.c rtnl.c)
21 ELSE()
22 SET(nl "")
23 SET(bpf "")
24 ENDIF()
25 IF(UBUS_SUPPORT)
26 SET(SOURCES ${SOURCES} ubus.c)
27 ADD_DEFINITIONS(-DUBUS_SUPPORT=1)
28 FIND_LIBRARY(ubus ubus)
29 ELSE()
30 SET(ubus "")
31 ENDIF()
32
33 ADD_LIBRARY(unet SHARED curve25519.c siphash.c)
34 TARGET_LINK_LIBRARIES(unet ubox)
35
36 ADD_EXECUTABLE(unetd ${SOURCES})
37 TARGET_LINK_LIBRARIES(unetd unet ubox ${ubus} blobmsg_json ${libjson} ${nl} ${bpf})
38
39 INSTALL(TARGETS unetd unet
40 RUNTIME DESTINATION sbin
41 LIBRARY DESTINATION lib
42 )