cmake_minimum_required(VERSION 2.6)
PROJECT(netifd C)
-ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -Wmissing-declarations)
+
+IF(NOT ${CMAKE_VERSION} LESS 3.0)
+ include(CheckCCompilerFlag)
+ check_c_compiler_flag(-Wimplicit-fallthrough HAS_IMPLICIT_FALLTHROUGH)
+ENDIF()
+
+ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -Wmissing-declarations -Wno-unknown-warning-option -Wno-format-truncation)
+
+IF(HAS_IMPLICIT_FALLTHROUGH)
+ ADD_DEFINITIONS(-Wimplicit-fallthrough)
+ENDIF()
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
main.c utils.c system.c tunnel.c handler.c
interface.c interface-ip.c interface-event.c
iprule.c proto.c proto-static.c proto-shell.c
- config.c device.c bridge.c vlan.c alias.c
- macvlan.c ubus.c vlandev.c wireless.c)
+ config.c device.c bridge.c veth.c vlan.c alias.c
+ macvlan.c ubus.c vlandev.c wireless.c
+ extdev.c bonding.c)
+
+
+FIND_LIBRARY(uci NAMES uci)
+FIND_LIBRARY(ubox NAMES ubox)
+FIND_LIBRARY(ubus NAMES ubus)
+FIND_LIBRARY(json NAMES json-c json)
+FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
+SET(LIBS ${ubox} ${ubus} ${uci} ${json} ${blobmsg_json})
-SET(LIBS
- ubox ubus uci json-c blobmsg_json)
+FIND_PATH(ubox_include_dir libubox/usock.h)
+INCLUDE_DIRECTORIES(${ubox_include_dir})
IF (NOT DEFINED LIBNL_LIBS)
- FIND_LIBRARY(libnl NAMES libnl-3 libnl nl-3 nl)
- SET(LIBNL_LIBS ${libnl})
+ include(FindPkgConfig)
+ pkg_search_module(LIBNL libnl-3.0 libnl-3 libnl nl-3 nl)
+ IF (LIBNL_FOUND)
+ include_directories(${LIBNL_INCLUDE_DIRS})
+ SET(LIBNL_LIBS ${LIBNL_LIBRARIES})
+ ENDIF()
ENDIF()
IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" AND NOT DUMMY_MODE)