netifd: fix undefined va_list value which can cause crashes
[project/netifd.git] / CMakeLists.txt
index b87c300fcc221a20cc047d56e8a4911ce4622508..8e86bd4ce598738daa1848895f3c9d3d38e4259c 100644 (file)
@@ -7,11 +7,12 @@ IF(NOT ${CMAKE_VERSION} LESS 3.0)
   check_c_compiler_flag(-Wimplicit-fallthrough HAS_IMPLICIT_FALLTHROUGH)
 ENDIF()
 
-ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -Wmissing-declarations -Wno-unused-parameter -Wno-unused-but-set-parameter)
+ADD_DEFINITIONS(-Wall -Werror)
 IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6)
        add_definitions(-Wextra -Werror=implicit-function-declaration)
        add_definitions(-Wformat -Werror=format-security -Werror=format-nonliteral)
 ENDIF()
+ADD_DEFINITIONS(-Os --std=gnu99 -Wmissing-declarations -Wno-unused-parameter -Wno-unused-but-set-parameter)
 
 IF(HAS_IMPLICIT_FALLTHROUGH)
   ADD_DEFINITIONS(-Wimplicit-fallthrough)
@@ -32,11 +33,13 @@ FIND_LIBRARY(uci NAMES uci)
 FIND_LIBRARY(ubox NAMES ubox)
 FIND_LIBRARY(ubus NAMES ubus)
 FIND_LIBRARY(json NAMES json-c json)
+FIND_LIBRARY(udebug NAMES udebug)
 FIND_LIBRARY(blobmsg_json NAMES blobmsg_json)
 
-SET(LIBS ${ubox} ${ubus} ${uci} ${json} ${blobmsg_json})
+SET(LIBS ${ubox} ${ubus} ${uci} ${json} ${blobmsg_json} ${udebug})
 
 FIND_PATH(ubox_include_dir libubox/usock.h)
+FIND_PATH(udebug_include_dir udebug.h)
 INCLUDE_DIRECTORIES(${ubox_include_dir})
 
 IF (NOT DEFINED LIBNL_LIBS)
@@ -48,6 +51,13 @@ IF (NOT DEFINED LIBNL_LIBS)
        ENDIF()
 ENDIF()
 
+ADD_CUSTOM_COMMAND(
+       OUTPUT ethtool-modes.h
+       COMMAND ./make_ethtool_modes_h.sh ${CMAKE_C_COMPILER} > ./ethtool-modes.h
+       DEPENDS ./make_ethtool_modes_h.sh
+)
+ADD_CUSTOM_TARGET(ethtool-modes-h DEPENDS ethtool-modes.h)
+
 IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" AND NOT DUMMY_MODE)
        SET(SOURCES ${SOURCES} system-linux.c)
        SET(LIBS ${LIBS} ${LIBNL_LIBS})
@@ -71,3 +81,4 @@ TARGET_LINK_LIBRARIES(netifd ${LIBS})
 INSTALL(TARGETS netifd
        RUNTIME DESTINATION sbin
 )
+ADD_DEPENDENCIES(netifd ethtool-modes-h)