File: FindSystemd.cmake

package info (click to toggle)
openscap 1.4.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 125,040 kB
  • sloc: xml: 527,109; ansic: 91,390; sh: 19,789; python: 2,515; perl: 444; makefile: 49
file content (25 lines) | stat: -rw-r--r-- 827 bytes parent folder | download | duplicates (3)
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
# https://raw.githubusercontent.com/ximion/limba/master/data/cmake/systemdservice.cmake
#
# Find systemd service dir

include(LibFindMacros)

# Use pkg-config to get hints about paths
libfind_pkg_check_modules(SYSTEMD systemd)

if(SYSTEMD_FOUND AND "${SYSTEMD_UNITDIR}" STREQUAL "")
  execute_process(
    COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=systemdsystemunitdir systemd
    OUTPUT_VARIABLE SYSTEMD_UNITDIR
  )
  string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_UNITDIR "${SYSTEMD_UNITDIR}")
elseif(NOT SYSTEMD_FOUND AND SYSTEMD_UNITDIR)
  message(FATAL_ERROR "Variable SYSTEMD_UNITDIR is defined, but we can't find systemd using pkg-config")
endif()

if(SYSTEMD_FOUND)
  set(WITH_SYSTEMD "ON")
  message(STATUS "Found systemd, services install dir: ${SYSTEMD_UNITDIR}")
else()
  set(WITH_SYSTEMD "OFF")
endif(SYSTEMD_FOUND)