X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=CMakeLists.txt;h=38709ec30826cacf51f4446be7b8d0b88f43276b;hb=791a361ad1b08fa56e554654109122b828657a2b;hp=c574bf72305e95a3cfd2ba1a208a72f69d5f3413;hpb=7c11f6e91338eb73a1015606e55798d09369b2e8;p=project%2Flibubox.git diff --git a/CMakeLists.txt b/CMakeLists.txt index c574bf7..38709ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,21 +7,18 @@ ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations) OPTION(BUILD_LUA "build Lua plugin" ON) -IF(APPLE) - INCLUDE_DIRECTORIES(/opt/local/include) - LINK_DIRECTORIES(/opt/local/lib) -ENDIF() - INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(JSONC json) +PKG_SEARCH_MODULE(JSONC json-c) IF(JSONC_FOUND) ADD_DEFINITIONS(-DJSONC) INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS}) ENDIF() -SET(SOURCES avl.c avl-cmp.c blob.c blobmsg.c uloop.c usock.c ustream.c ustream-fd.c vlist.c utils.c safe_list.c) +SET(SOURCES avl.c avl-cmp.c blob.c blobmsg.c uloop.c usock.c ustream.c ustream-fd.c vlist.c utils.c safe_list.c runqueue.c md5.c kvlist.c ulog.c base64.c) ADD_LIBRARY(ubox SHARED ${SOURCES}) +ADD_LIBRARY(ubox-static STATIC ${SOURCES}) +SET_TARGET_PROPERTIES(ubox-static PROPERTIES OUTPUT_NAME ubox) SET(LIBS) CHECK_FUNCTION_EXISTS(clock_gettime HAVE_GETTIME) @@ -36,19 +33,21 @@ FILE(GLOB headers *.h) INSTALL(FILES ${headers} DESTINATION include/libubox ) -INSTALL(TARGETS ubox +INSTALL(TARGETS ubox ubox-static + ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) ADD_SUBDIRECTORY(lua) +ADD_SUBDIRECTORY(examples) -find_library(json NAMES json-c json) +find_library(json NAMES json-c) IF(EXISTS ${json}) ADD_LIBRARY(blobmsg_json SHARED blobmsg_json.c) TARGET_LINK_LIBRARIES(blobmsg_json ubox ${json}) ADD_EXECUTABLE(jshn jshn.c) - TARGET_LINK_LIBRARIES(jshn ${json}) + TARGET_LINK_LIBRARIES(jshn blobmsg_json ${json}) ADD_LIBRARY(json_script SHARED json_script.c) TARGET_LINK_LIBRARIES(json_script ubox)