2 # Find systemd service dir
5 # SYSTEMD_SERVICES_INSTALL_DIR
7 find_package(PkgConfig QUIET REQUIRED)
10 pkg_check_modules(SYSTEMD "systemd")
13 if (SYSTEMD_FOUND AND "${SYSTEMD_SERVICES_INSTALL_DIR}" STREQUAL "")
14 execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
15 --variable=systemdsystemunitdir systemd
16 OUTPUT_VARIABLE SYSTEMD_SERVICES_INSTALL_DIR)
17 string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_SERVICES_INSTALL_DIR
18 "${SYSTEMD_SERVICES_INSTALL_DIR}")
19 elseif (NOT SYSTEMD_FOUND AND SYSTEMD_SERVICES_INSTALL_DIR)
20 message (FATAL_ERROR "Variable SYSTEMD_SERVICES_INSTALL_DIR is\
21 defined, but we can't find systemd using pkg-config")
25 message(STATUS "systemd services install dir: ${SYSTEMD_SERVICES_INSTALL_DIR}")