de0c74b35829721d99d6bb6c10c420b9b07f29ef
[project/netifd.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2
3 PROJECT(netifd C)
4 ADD_DEFINITIONS(-Os -Wall -Werror)
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 interface.c interface-ip.c
15         proto.c proto-static.c proto-shell.c
16         config.c device.c bridge.c vlan.c ubus.c)
17
18 SET(LIBS
19         ubox ubus uci json blobmsg_json)
20
21 IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
22         SET(SOURCES ${SOURCES} system-linux.c)
23         SET(LIBS ${LIBS} nl)
24 ELSE()
25         SET(SOURCES ${SOURCES} system-dummy.c)
26 ENDIF()
27
28 IF(DEBUG)
29   ADD_DEFINITIONS(-DDEBUG -O0 --std=gnu99 -g3)
30 ENDIF()
31
32
33 ADD_EXECUTABLE(netifd ${SOURCES})
34
35 TARGET_LINK_LIBRARIES(netifd ${LIBS})