2015-11-06 21:03:18 +03:00
|
|
|
#######
|
|
|
|
# Find systemd service dir
|
|
|
|
# sets variables
|
|
|
|
# SYSTEMD_FOUND
|
|
|
|
# SYSTEMD_SERVICES_INSTALL_DIR
|
2017-05-19 11:44:36 +03:00
|
|
|
|
|
|
|
find_package(PkgConfig QUIET REQUIRED)
|
|
|
|
|
2015-11-06 21:03:18 +03:00
|
|
|
if (NOT SYSTEMD_FOUND)
|
|
|
|
pkg_check_modules(SYSTEMD "systemd")
|
2020-05-03 21:28:07 +03:00
|
|
|
endif()
|
2015-11-06 21:03:18 +03:00
|
|
|
|
|
|
|
if (SYSTEMD_FOUND AND "${SYSTEMD_SERVICES_INSTALL_DIR}" STREQUAL "")
|
|
|
|
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
|
|
|
|
--variable=systemdsystemunitdir systemd
|
|
|
|
OUTPUT_VARIABLE SYSTEMD_SERVICES_INSTALL_DIR)
|
|
|
|
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_SERVICES_INSTALL_DIR
|
|
|
|
"${SYSTEMD_SERVICES_INSTALL_DIR}")
|
|
|
|
elseif (NOT SYSTEMD_FOUND AND SYSTEMD_SERVICES_INSTALL_DIR)
|
|
|
|
message (FATAL_ERROR "Variable SYSTEMD_SERVICES_INSTALL_DIR is\
|
|
|
|
defined, but we can't find systemd using pkg-config")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (SYSTEMD_FOUND)
|
|
|
|
message(STATUS "systemd services install dir: ${SYSTEMD_SERVICES_INSTALL_DIR}")
|
2020-05-03 21:28:07 +03:00
|
|
|
endif()
|