-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathCMakeLists.txt
69 lines (53 loc) · 1.52 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
cmake_minimum_required(VERSION 2.6)
PROJECT(ubox C)
ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations)
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
IF(APPLE)
INCLUDE_DIRECTORIES(/opt/local/include)
LINK_DIRECTORIES(/opt/local/lib)
ENDIF()
find_library(json NAMES json-c json)
IF(DEBUG)
ADD_DEFINITIONS(-DDEBUG -g3)
ENDIF()
INCLUDE (CheckSymbolExists)
CHECK_SYMBOL_EXISTS(SYS_getrandom syscall.h getrandom)
IF(getrandom)
ADD_EXECUTABLE(getrandom getrandom.c)
INSTALL(TARGETS getrandom
RUNTIME DESTINATION bin
)
ELSE()
message( FATAL_ERROR "Kernel too old, missing SYS_getrandom system call")
ENDIF()
ADD_EXECUTABLE(kmodloader kmodloader.c)
TARGET_LINK_LIBRARIES(kmodloader ubox)
INSTALL(TARGETS kmodloader
RUNTIME DESTINATION sbin
)
ADD_EXECUTABLE(lsbloader lsbloader.c)
TARGET_LINK_LIBRARIES(lsbloader ubox ubus)
INSTALL(TARGETS lsbloader
RUNTIME DESTINATION sbin
)
ADD_LIBRARY(validate SHARED validate/validate.c)
INSTALL(TARGETS validate
LIBRARY DESTINATION lib
)
FIND_PATH(uci_include_dir uci.h)
INCLUDE_DIRECTORIES(${uci_include_dir})
ADD_EXECUTABLE(validate_data validate/cli.c)
TARGET_LINK_LIBRARIES(validate_data ubox uci validate)
INSTALL(TARGETS validate_data
RUNTIME DESTINATION sbin
)
ADD_EXECUTABLE(logd log/logd.c log/syslog.c)
TARGET_LINK_LIBRARIES(logd ubox ubus udebug)
INSTALL(TARGETS logd
RUNTIME DESTINATION sbin
)
ADD_EXECUTABLE(logread log/logread.c)
TARGET_LINK_LIBRARIES(logread ubox ubus ${json} blobmsg_json)
INSTALL(TARGETS logread
RUNTIME DESTINATION sbin
)