summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindSystemd.cmake
blob: 2fa2724b785959434d7b7c1457e7876e6258cf94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#
# - Find systemd libraries
#
#  SYSTEMD_INCLUDE_DIRS - where to find systemd/sd-journal.h, etc.
#  SYSTEMD_LIBRARIES    - List of libraries when using libsystemd.
#  SYSTEMD_FOUND        - True if libsystemd is found.

pkg_search_module(PC_SYSTEMD QUIET libsystemd)

find_path(SYSTEMD_INCLUDE_DIR
  NAMES
    systemd/sd-journal.h
  HINTS
    ${PC_SYSTEMD_INCLUDE_DIRS}
)

find_library(SYSTEMD_LIBRARY
  NAMES
    systemd
  HINTS
    ${PC_SYSTEMD_LIBRARY_DIRS}
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Systemd
  REQUIRED_VARS   SYSTEMD_LIBRARY SYSTEMD_INCLUDE_DIR
  VERSION_VAR     PC_SYSTEMD_VERSION)

if(SYSTEMD_FOUND)
  set(SYSTEMD_LIBRARIES ${SYSTEMD_LIBRARY})
  set(SYSTEMD_INCLUDE_DIRS ${SYSTEMD_INCLUDE_DIR})
else()
  set(SYSTEMD_LIBRARIES)
  set(SYSTEMD_INCLUDE_DIRS)
endif()

mark_as_advanced(SYSTEMD_LIBRARIES SYSTEMD_INCLUDE_DIRS)