netifd: Fix printf calls + function declarations.
[project/netifd.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2
3 PROJECT(netifd C)
4 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -Wmissing-declarations -Wno-unknown-warning-option -Wno-format-truncation)
5
6 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
7
8 SET(SOURCES
9         main.c utils.c system.c tunnel.c handler.c
10         interface.c interface-ip.c interface-event.c
11         iprule.c proto.c proto-static.c proto-shell.c
12         config.c device.c bridge.c veth.c vlan.c alias.c
13         macvlan.c ubus.c vlandev.c wireless.c)
14
15
16 SET(LIBS
17         ubox ubus uci json-c blobmsg_json)
18
19 IF (NOT DEFINED LIBNL_LIBS)
20   FIND_LIBRARY(libnl NAMES libnl-3 libnl nl-3 nl)
21   SET(LIBNL_LIBS ${libnl})
22 ENDIF()
23
24 IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" AND NOT DUMMY_MODE)
25         SET(SOURCES ${SOURCES} system-linux.c)
26         SET(LIBS ${LIBS} ${LIBNL_LIBS})
27 ELSE()
28         ADD_DEFINITIONS(-DDUMMY_MODE=1)
29         SET(SOURCES ${SOURCES} system-dummy.c)
30 ENDIF()
31
32 IF(DEBUG)
33   ADD_DEFINITIONS(-DDEBUG -g3)
34   IF(NO_OPTIMIZE)
35     ADD_DEFINITIONS(-O0)
36   ENDIF()
37 ENDIF()
38
39
40 ADD_EXECUTABLE(netifd ${SOURCES})
41
42 TARGET_LINK_LIBRARIES(netifd ${LIBS})
43
44 INSTALL(TARGETS netifd
45         RUNTIME DESTINATION sbin
46 )