mbusd/cmake/extern_GPL/FindSystemd.cmake
NickMa fb3d6d6489 Cmake gitlabci (#25)
* gitlabci: hardcoded the debian systemd path

* cmake: no failure on forced SYSTEMD_SERVICES_INSTALL_DIR

* gitlabci: added fedora target

* gitlabci: added fedora package

* gitlabci: added another fedora package

* gitlabci: fedora changed rpmbuilder

* fedora...

* fedora package name try4

* rpmdevtools detection

* gitlabci: changed rpm detection

* gitlabci: rpmbuilder detection

* rpmbuilder added references

* gitlabci: changed the expiration timespan to 6months

* removed always false comparison (dbglvl is unsigned)
2018-03-05 17:19:52 +03:00

27 lines
881 B
CMake

#######
# Find systemd service dir
# sets variables
# SYSTEMD_FOUND
# SYSTEMD_SERVICES_INSTALL_DIR
find_package(PkgConfig QUIET REQUIRED)
if (NOT SYSTEMD_FOUND)
pkg_check_modules(SYSTEMD "systemd")
endif(NOT SYSTEMD_FOUND)
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 (INFO "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}")
endif(SYSTEMD_FOUND)