Find the correct install paths for systemd units and udev rules (#2046)

This commit is contained in:
PVermeer 2024-01-21 22:53:30 +01:00 committed by GitHub
commit 0d4dfcd708
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 71 additions and 2 deletions

28
cmake/FindUdev.cmake Normal file
View file

@ -0,0 +1,28 @@
# - Try to find Udev
# Once done this will define
#
# UDEV_FOUND - system has udev
# UDEV_RULES_INSTALL_DIR - the udev rules install directory
IF (NOT WIN32)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(UDEV "udev")
endif()
if (UDEV_FOUND)
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
--variable=udevdir udev
OUTPUT_VARIABLE UDEV_RULES_INSTALL_DIR)
string(REGEX REPLACE "[ \t\n]+" "" UDEV_RULES_INSTALL_DIR
"${UDEV_RULES_INSTALL_DIR}")
set(UDEV_RULES_INSTALL_DIR "${UDEV_RULES_INSTALL_DIR}/rules.d")
mark_as_advanced(UDEV_RULES_INSTALL_DIR)
endif ()
ENDIF ()