detach stdin/stdout/stderr from child processes, implement a separate logging pipe...
[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)
5
6 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
7
8 IF(APPLE)
9   INCLUDE_DIRECTORIES(/opt/local/include)
10   LINK_DIRECTORIES(/opt/local/lib)
11 ENDIF()
12
13 SET(SOURCES
14         main.c utils.c
15         interface.c interface-ip.c interface-event.c
16         proto.c proto-static.c proto-shell.c
17         config.c device.c bridge.c vlan.c ubus.c)
18
19 SET(LIBS
20         ubox ubus uci json blobmsg_json)
21
22 IF (NOT DEFINED LIBNL_LIBS)
23   SET(LIBNL_LIBS -lnl)
24 ENDIF()
25
26 IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" AND NOT DUMMY_MODE)
27         SET(SOURCES ${SOURCES} system-linux.c)
28         SET(LIBS ${LIBS} ${LIBNL_LIBS})
29 ELSE()
30         ADD_DEFINITIONS(-DDUMMY_MODE=1)
31         SET(SOURCES ${SOURCES} system-dummy.c)
32 ENDIF()
33
34 IF(DEBUG)
35   ADD_DEFINITIONS(-DDEBUG -g3)
36 ENDIF()
37
38
39 ADD_EXECUTABLE(netifd ${SOURCES})
40
41 TARGET_LINK_LIBRARIES(netifd ${LIBS})
42
43 INSTALL(TARGETS netifd
44         RUNTIME DESTINATION sbin
45 )