-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
51 lines (40 loc) · 1.37 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
cmake_minimum_required(VERSION 2.8)
INCLUDE (CheckIncludeFiles)
INCLUDE(FindPkgConfig)
PROJECT(usteerd C)
IF("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" AND NOT NL_CFLAGS)
FIND_PROGRAM(PKG_CONFIG pkg-config)
IF(PKG_CONFIG)
EXECUTE_PROCESS(
COMMAND pkg-config --silence-errors --cflags libnl-tiny
OUTPUT_VARIABLE NL_CFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
EXECUTE_PROCESS(
COMMAND pkg-config --silence-errors --libs libnl-tiny
OUTPUT_VARIABLE NL_LIBS
OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDIF()
ENDIF()
CHECK_INCLUDE_FILES(pcap/pcap.h HAVE_PCAP_H)
IF(NOT HAVE_PCAP_H)
UNSET(HAVE_PCAP_H CACHE)
MESSAGE(FATAL_ERROR "pcap/pcap.h is not found")
ENDIF()
SET(SOURCES main.c local_node.c node.c sta.c policy.c ubus.c remote.c parse.c netifd.c timeout.c event.c measurement.c)
IF(NL_CFLAGS)
ADD_DEFINITIONS(${NL_CFLAGS})
SET(SOURCES ${SOURCES} nl80211.c)
ENDIF()
ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations)
FIND_LIBRARY(libjson NAMES json-c json)
ADD_EXECUTABLE(usteerd ${SOURCES})
ADD_EXECUTABLE(fakeap fakeap.c timeout.c)
TARGET_LINK_LIBRARIES(usteerd ubox ubus blobmsg_json
${LIBS_EXTRA} ${libjson} ${NL_LIBS})
TARGET_LINK_LIBRARIES(fakeap ubox ubus)
ADD_EXECUTABLE(ap-monitor monitor.c parse.c)
TARGET_LINK_LIBRARIES(ap-monitor ubox pcap blobmsg_json)
SET(CMAKE_INSTALL_PREFIX /usr)
INSTALL(TARGETS usteerd
RUNTIME DESTINATION sbin
)