summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2016-05-24 02:01:48 +0200
committerJohn Crispin <john@phrozen.org>2016-06-01 11:32:46 +0200
commit964adfdd3923ef1b54eb5c19487dd8e9e3f586b7 (patch)
tree92eb38a5e472743b3b24eb805796172d1e972ea8 /CMakeLists.txt
parent3b8d4b5653ef47bd2032d377cecfee40b613eb72 (diff)
downloadubus-964adfdd3923ef1b54eb5c19487dd8e9e3f586b7.tar.gz
ubusd: fix systemd socket activation support
62cdfc3 added systemd units including a ubus.socket unit, but didn't actually add socket activation support to ubusd. This would cause the first connection that activated ubusd to hang (as ubusd ignored it), and stopping ubusd would break it completely (as ubusd removed the socket file). The ENABLE_SYSTEMD default is changed to OFF as the socket activation uses libsystemd, so setting ENABLE_SYSTEMD to ON will now require libsystemd. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt15
1 files changed, 10 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e21a046..faab342 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +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)
+OPTION(ENABLE_SYSTEMD "systemd support" OFF)
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
SET(UBUS_UNIX_SOCKET "/var/run/ubus.sock")
@@ -60,8 +60,13 @@ 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()
+ PKG_CHECK_MODULES(SYSTEMD libsystemd REQUIRED)
+
+ SET_PROPERTY(TARGET ubusd APPEND PROPERTY COMPILE_FLAGS "${SYSTEMD_CFLAGS}")
+ SET_PROPERTY(TARGET ubusd APPEND PROPERTY LINK_FLAGS "${SYSTEMD_LDFLAGS}")
+ SET_PROPERTY(TARGET ubusd APPEND PROPERTY INCLUDE_DIRECTORIES ${SYSTEMD_INCLUDE_DIRS})
+ TARGET_LINK_LIBRARIES(ubusd ${SYSTEMD_LIBRARIES})
+ ADD_DEFINITIONS( -DENABLE_SYSTEMD)
+
+ ADD_SUBDIRECTORY(systemd)
ENDIF()