File: FindSystemd.cmake

package info (click to toggle)
rdma-core 33.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,844 kB
  • sloc: ansic: 145,804; python: 5,688; sh: 2,761; perl: 1,465; makefile: 73
file content (30 lines) | stat: -rw-r--r-- 1,218 bytes parent folder | download | duplicates (5)
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
# COPYRIGHT (c) 2015 Obsidian Research Corporation.
# Licensed under BSD (MIT variant) or GPLv2. See COPYING.

find_path(LIBSYSTEMD_INCLUDE_DIRS "systemd/sd-journal.h")

if (LIBSYSTEMD_INCLUDE_DIRS)
  set(SYSTEMD_INCLUDE_DIRS ${LIBSYSTEMD_INCLUDE_DIRS})
  find_library(LIBSYSTEMD_LIBRARY NAMES systemd libsystemd)
  # Older systemd uses a split library
  if (NOT LIBSYSTEMD_LIBRARY)
    find_library(LIBSYSTEMD_JOURNAL_LIBRARY NAMES systemd-journal libsystemd-journal)
    find_library(LIBSYSTEMD_ID128_LIBRARY NAMES systemd-id128 libsystemd-id128)
    find_library(LIBSYSTEMD_DAEMON_LIBRARY NAMES systemd-daemon libsystemd-daemon)

    if (LIBSYSTEMD_JOURNAL_LIBRARY AND LIBSYSTEMD_ID128_LIBRARY AND LIBSYSTEMD_DAEMON_LIBRARY)
      set(SYSTEMD_LIBRARIES
	${LIBSYSTEMD_JOURNAL_LIBRARY}
	${LIBSYSTEMD_ID128_LIBRARY}
	${LIBSYSTEMD_DAEMON_LIBRARY})
    endif()
  else()
    set(SYSTEMD_LIBRARIES ${LIBSYSTEMD_LIBRARY})
  endif()
  set(SYSTEMD_INCLUDE_DIRS)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Systemd REQUIRED_VARS SYSTEMD_LIBRARIES LIBSYSTEMD_INCLUDE_DIRS)

mark_as_advanced(LIBSYSTEMD_LIBRARY LIBSYSTEMD_JOURNAL_LIBRARY LIBSYSTEMD_ID128_LIBRARY LIBSYSTEMD_DAEMON_LIBRARY)