Skip to content

Commit

Permalink
build: make systemd integration optional
Browse files Browse the repository at this point in the history
Signed-off-by: He Xian <hexian000@outlook.com>
  • Loading branch information
hexian000 committed Jun 8, 2024
1 parent 3d674d7 commit 15ee896
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ option(FORCE_POSIX "Build the core features using POSIX-compliant APIs only" OFF
option(BUILD_STATIC "Build static executables, link everything statically" OFF)
option(LINK_STATIC_LIBS "Link against static libraries" OFF)
option(ENABLE_SANITIZERS "Build with sanitizers" OFF)
option(ENABLE_SYSTEMD "Enable systemd integration" OFF)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
Expand Down
5 changes: 2 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ endif()
if((NOT ${LIBEV_VERSION} VERSION_GREATER_EQUAL "4.31") OR (NOT EXISTS ${LIBEV_LIBRARY}))
message(FATAL_ERROR "libev (>= 4.31) not found")
endif()
message(STATUS "libev: ${LIBEV_VERSION}")
message(STATUS "libev: ${LIBEV_LIBRARY}")
message(STATUS "libev ${LIBEV_VERSION}: ${LIBEV_LIBRARY}")
target_include_directories(kcptun-libev SYSTEM PRIVATE ${LIBEV_INCLUDE_DIR})
target_link_libraries(kcptun-libev PRIVATE ${LIBEV_LIBRARY})

Expand Down Expand Up @@ -85,7 +84,7 @@ if(WITH_CRYPTO AND TARGET_LINUX)
endif()

# find systemd
if(NOT FORCE_POSIX AND NOT BUILD_STATIC)
if(ENABLE_SYSTEMD)
find_path(SYSTEMD_INCLUDE_DIR NAMES systemd/sd-daemon.h)
find_library(SYSTEMD_LIBRARY NAMES systemd)
if((EXISTS ${SYSTEMD_INCLUDE_DIR}) AND (EXISTS ${SYSTEMD_LIBRARY}))
Expand Down

0 comments on commit 15ee896

Please sign in to comment.