cmake: check for optional libsystemd presence
This commit is contained in:
parent
1a1133bf8e
commit
f221fac02e
|
@ -0,0 +1,28 @@
|
|||
include(FindPkgConfig)
|
||||
pkg_check_modules(PC_SYSTEMD QUIET "libsystemd")
|
||||
if (PC_SYSTEMD_FOUND)
|
||||
add_definitions(${PC_SYSTEMD_CFLAGS} ${PC_SYSTEMD_CFLAGS_OTHER})
|
||||
endif(PC_SYSTEMD_FOUND)
|
||||
|
||||
find_path(
|
||||
SYSTEMD_INCLUDE_DIRS
|
||||
NAMES systemd/sd-daemon.h
|
||||
HINTS ${PC_SYSTEMD_INCLUDEDIR} ${PC_SYSTEMD_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_library(
|
||||
SYSTEMD_LIBRARIES
|
||||
NAMES systemd
|
||||
HINTS ${PC_SYSTEMD_LIBDIR} ${PC_SYSTEMD_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package_handle_standard_args(
|
||||
SYSTEMD
|
||||
REQUIRED_VARS SYSTEMD_LIBRARIES SYSTEMD_INCLUDE_DIRS
|
||||
)
|
||||
mark_as_advanced(
|
||||
SYSTEMD_FOUND
|
||||
SYSTEMD_LIBRARIES SYSTEMD_INCLUDE_DIRS
|
||||
)
|
|
@ -757,6 +757,14 @@ if(ENABLE_WX)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
find_package(Libsystemd)
|
||||
if(SYSTEMD_FOUND)
|
||||
message(STATUS "libsystemd found, enabling traversal server watchdog support")
|
||||
add_definitions(-DHAVE_LIBSYSTEMD)
|
||||
else()
|
||||
message(STATUS "libsystemd not found, disabling traversal server watchdog support")
|
||||
endif()
|
||||
|
||||
########################################
|
||||
# Pre-build events: Define configuration variables and write SCM info header
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue