1# - Find SystemdDaemon
2# Find the systemd daemon library
3#
4# This module defines the following variables:
5#   SYSTEMD_FOUND  -  True if library and include directory are found
6# If set to TRUE, the following are also defined:
7#   SYSTEMD_INCLUDE_DIRS  -  The directory where to find the header file
8#   SYSTEMD_LIBRARIES  -  Where to find the library file
9#
10# For conveniance, these variables are also set. They have the same values
11# than the variables above.  The user can thus choose his/her prefered way
12# to write them.
13#   SYSTEMD_LIBRARY
14#   SYSTEMD_INCLUDE_DIR
15#
16# This file is in the public domain
17
18include(FindPkgConfig)
19if(NOT SYSTEMD_FOUND)
20  pkg_check_modules(SYSTEMD libsystemd)
21endif()
22
23if(NOT SYSTEMD_FOUND)
24  find_path(SYSTEMD_INCLUDE_DIRS NAMES systemd/sd-daemon.h
25    DOC "The Systemd include directory")
26
27  find_library(SYSTEMD_LIBRARIES NAMES systemd
28    DOC "The Systemd library")
29
30  # Use some standard module to handle the QUIETLY and REQUIRED arguments, and
31  # set SYSTEMD_FOUND to TRUE if these two variables are set.
32  include(FindPackageHandleStandardArgs)
33  find_package_handle_standard_args(SYSTEMD REQUIRED_VARS SYSTEMD_LIBRARIES SYSTEMD_INCLUDE_DIRS)
34
35  if(SYSTEMD_FOUND)
36    set(SYSTEMD_LIBRARY ${SYSTEMD_LIBRARIES} CACHE INTERNAL "")
37    set(SYSTEMD_INCLUDE_DIR ${SYSTEMD_INCLUDE_DIRS} CACHE INTERNAL "")
38    set(SYSTEMD_FOUND ${SYSTEMD_FOUND} CACHE INTERNAL "")
39  endif()
40endif()
41
42mark_as_advanced(SYSTEMD_INCLUDE_DIRS SYSTEMD_LIBRARIES)
43