qBittorrent/cmake/Modules/FindSystemd.cmake
FranciscoPombal 46123b9989 CMake: overhaul and improve scripts
- Bump minimum required version and
make use of more modern language features
- Rely more on target_...() commands to establish dependency
relationships between targets rather than directory property commands
- Improve libtorrent package discovery
- Enable and handle application features more explicitly
- Improve user-facing output
- Fix various compilation issues on Windows (MSVC and MinGW) and macOS
- Improve handling of translations
- Add explanatory comments where relevant
- Make CMake scripts fully independent of qmake files/details
- Remove old functions/macros
2020-09-17 13:13:26 +01:00

26 lines
858 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()
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}")
endif()