1 cmake_minimum_required(VERSION 2.6)
4 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -Wmissing-declarations)
6 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
9 INCLUDE_DIRECTORIES(/opt/local/include)
10 LINK_DIRECTORIES(/opt/local/lib)
14 main.c utils.c system.c tunnel.c handler.c
15 interface.c interface-ip.c interface-event.c
16 iprule.c proto.c proto-static.c proto-shell.c
17 config.c device.c bridge.c vlan.c alias.c
18 macvlan.c ubus.c vlandev.c wireless.c)
21 find_library(json NAMES json-c json)
23 ubox ubus uci ${json} blobmsg_json)
25 IF (NOT DEFINED LIBNL_LIBS)
26 FIND_LIBRARY(libnl NAMES libnl-3 libnl nl-3 nl)
27 SET(LIBNL_LIBS ${libnl})
30 IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" AND NOT DUMMY_MODE)
31 SET(SOURCES ${SOURCES} system-linux.c)
32 SET(LIBS ${LIBS} ${LIBNL_LIBS})
34 ADD_DEFINITIONS(-DDUMMY_MODE=1)
35 SET(SOURCES ${SOURCES} system-dummy.c)
39 ADD_DEFINITIONS(-DDEBUG -g3)
46 ADD_EXECUTABLE(netifd ${SOURCES})
48 TARGET_LINK_LIBRARIES(netifd ${LIBS})
50 INSTALL(TARGETS netifd
51 RUNTIME DESTINATION sbin