X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=CMakeLists.txt;h=e3b150b7310eef35a022a02a742b9e8459e1a902;hb=b356773921a89b370f8ccb34c9ea5f21148115ea;hp=01b43c08ff9a37c65d22bf637e34c56859d7c038;hpb=29a2ed2f17350f29680fd7cdcae9d3a1e3e5886b;p=project%2Fubus.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 01b43c0..e3b150b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations) OPTION(BUILD_LUA "build Lua plugin" ON) OPTION(BUILD_EXAMPLES "build examples" ON) +OPTION(ENABLE_SYSTEMD "systemd support" ON) SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") SET(UBUS_UNIX_SOCKET "/var/run/ubus.sock") @@ -22,9 +23,10 @@ TARGET_LINK_LIBRARIES(ubus ubox) ADD_EXECUTABLE(ubusd ubusd.c ubusd_id.c ubusd_obj.c ubusd_proto.c ubusd_event.c) TARGET_LINK_LIBRARIES(ubusd ubox) +find_library(json NAMES json-c json) ADD_EXECUTABLE(cli cli.c) SET_TARGET_PROPERTIES(cli PROPERTIES OUTPUT_NAME ubus) -TARGET_LINK_LIBRARIES(cli ubus ubox blobmsg_json json) +TARGET_LINK_LIBRARIES(cli ubus ubox blobmsg_json ${json}) ADD_SUBDIRECTORY(lua) ADD_SUBDIRECTORY(examples) @@ -38,3 +40,15 @@ INSTALL(TARGETS ubusd ) INSTALL(FILES ubusmsg.h ubus_common.h libubus.h DESTINATION include) + +# FIXME: this works but certainly can be done better: +SET(UBUSD_BINARY "${CMAKE_INSTALL_PREFIX}/sbin/ubusd") + +# do this after the installs so we have the proper paths +IF(ENABLE_SYSTEMD) + INCLUDE(FindPkgConfig) + PKG_CHECK_MODULES(SYSTEMD systemd) + IF(SYSTEMD_FOUND) + ADD_SUBDIRECTORY(systemd) + ENDIF() +ENDIF()