-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
36 lines (25 loc) · 1.01 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
cmake_minimum_required(VERSION 2.6)
PROJECT(ucentral-wifi C)
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 -g3 -Wmissing-declarations -Wno-unused-parameter)
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
if(OPENWRT_BUILD)
add_definitions(-DOPENWRT_BUILD)
endif()
SET(SOURCES main.c nl80211.c ubus.c)
FIND_LIBRARY(ubus NAMES ubus)
FIND_LIBRARY(ubox NAMES ubox)
FIND_LIBRARY(nl-tiny NAMES nl-tiny)
FIND_PATH(ubox_include_dir libubox/uloop.h)
FIND_PATH(ubus_include_dir NAMES libubus.h)
FIND_PATH(libnl-tiny_include_dir netlink-generic.h PATH_SUFFIXES libnl-tiny)
INCLUDE_DIRECTORIES(${ubox_include_dir} ${ubus_include_dir} ${libnl-tiny_include_dir})
ADD_EXECUTABLE(ucentral-wifi ${SOURCES})
TARGET_LINK_LIBRARIES(ucentral-wifi ${ubox} ${ubus} ${nl-tiny})
INSTALL(TARGETS ucentral-wifi
RUNTIME DESTINATION sbin
)