1 cmake_minimum_required(VERSION 2.6)
2 INCLUDE(CheckLibraryExists)
3 INCLUDE(CheckFunctionExists)
6 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations)
8 OPTION(BUILD_LUA "build Lua plugin" ON)
11 INCLUDE_DIRECTORIES(/opt/local/include)
12 LINK_DIRECTORIES(/opt/local/lib)
15 SET(SOURCES avl.c avl-cmp.c blob.c blobmsg.c uloop.c usock.c ustream.c ustream-fd.c vlist.c utils.c)
17 ADD_LIBRARY(ubox SHARED ${SOURCES})
20 CHECK_FUNCTION_EXISTS(clock_gettime HAVE_GETTIME)
22 CHECK_LIBRARY_EXISTS(rt clock_gettime "" NEED_GETTIME)
24 TARGET_LINK_LIBRARIES(ubox rt)
29 SET(CMAKE_INSTALL_PREFIX /usr)
31 FILE(GLOB headers *.h)
32 INSTALL(FILES ${headers}
33 DESTINATION include/libubox
36 LIBRARY DESTINATION lib
41 find_library(json json)
43 ADD_LIBRARY(blobmsg_json SHARED blobmsg_json.c)
44 TARGET_LINK_LIBRARIES(blobmsg_json ubox json)
46 ADD_EXECUTABLE(jshn jshn.c)
47 TARGET_LINK_LIBRARIES(jshn json)
49 INSTALL(TARGETS blobmsg_json jshn
50 LIBRARY DESTINATION lib
51 RUNTIME DESTINATION bin
54 FILE(GLOB scripts sh/*.sh)
55 INSTALL(FILES ${scripts}
56 DESTINATION share/libubox