service: filter out duplicate members
[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 curve25519.c siphash.c
9 wg.c wg-dummy.c wg-user.c
10 )
11
12 SET(RUNSTATEDIR /var/run)
13
14 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations -DRUNSTATEDIR="${RUNSTATEDIR}")
15 FIND_LIBRARY(libjson NAMES json-c json)
16
17 OPTION(UBUS_SUPPORT "enable ubus support" ON)
18 IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
19 FIND_LIBRARY(nl nl-tiny)
20 SET(SOURCES ${SOURCES} wg-linux.c vxlan.c)
21 ELSE()
22 SET(nl "")
23 ENDIF()
24 IF(UBUS_SUPPORT)
25 SET(SOURCES ${SOURCES} ubus.c)
26 ADD_DEFINITIONS(-DUBUS_SUPPORT=1)
27 FIND_LIBRARY(ubus ubus)
28 ELSE()
29 SET(ubus "")
30 ENDIF()
31
32 ADD_EXECUTABLE(unetd ${SOURCES})
33 TARGET_LINK_LIBRARIES(unetd ubox ${ubus} blobmsg_json ${libjson} ${nl})
34
35 INSTALL(TARGETS unetd
36 RUNTIME DESTINATION sbin
37 LIBRARY DESTINATION lib
38 )