69c000dc84b43d204b02ec37dcd7e62c69e179ca
[project/ubox.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.6)
2
3 PROJECT(ubox C)
4 ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations)
5
6 SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
7
8 IF(APPLE)
9   INCLUDE_DIRECTORIES(/opt/local/include)
10   LINK_DIRECTORIES(/opt/local/lib)
11 ENDIF()
12
13 find_library(json NAMES json-c json)
14 SET(LIBS ubox uci ubus ${json} blobmsg_json)
15
16 IF(DEBUG)
17   ADD_DEFINITIONS(-DDEBUG -g3)
18 ENDIF()
19
20 ADD_EXECUTABLE(kmodloader kmodloader.c)
21 TARGET_LINK_LIBRARIES(kmodloader ${LIBS})
22
23 INSTALL(TARGETS kmodloader
24         RUNTIME DESTINATION sbin
25 )
26
27 ADD_EXECUTABLE(board board.c)
28 TARGET_LINK_LIBRARIES(board ${LIBS})
29
30 INSTALL(TARGETS board
31         RUNTIME DESTINATION sbin
32 )
33
34 ADD_EXECUTABLE(lsbloader lsbloader.c)
35 TARGET_LINK_LIBRARIES(lsbloader ${LIBS})
36
37 INSTALL(TARGETS lsbloader
38         RUNTIME DESTINATION sbin
39 )
40
41 ADD_LIBRARY(validate SHARED validate/validate.c)
42 INSTALL(TARGETS validate
43         LIBRARY DESTINATION lib
44 )
45
46 ADD_EXECUTABLE(validate_data validate/cli.c)
47 TARGET_LINK_LIBRARIES(validate_data ${LIBS} validate)
48 INSTALL(TARGETS validate_data
49         RUNTIME DESTINATION sbin
50 )
51
52 ADD_EXECUTABLE(logd log/logd.c log/syslog.c)
53 TARGET_LINK_LIBRARIES(logd ${LIBS})
54 INSTALL(TARGETS logd
55         RUNTIME DESTINATION sbin
56 )
57
58 ADD_EXECUTABLE(logread log/logread.c)
59 TARGET_LINK_LIBRARIES(logread ${LIBS})
60 INSTALL(TARGETS logread
61         RUNTIME DESTINATION sbin
62 )