Use variable for service install location
After enabling 'usrmerge', the install location for systemd service
files changed. This uses a variable to get the installation location
instead of hardcoding it.
Tested:
Confirmed that with 'usrmerge' enabled, the service file is correctly
installed.
Change-Id: Ie31fed1901949247cb1a64b16d1eb26b3a7f895c
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5cc4944..0b5f662 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,6 +66,9 @@
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-rtti")
+find_package (PkgConfig REQUIRED)
+pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir)
+
set (SERVICE_FILES
${PROJECT_SOURCE_DIR}/service_files/xyz.openbmc_project.PCIe.service)
-install (FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/)
+install (FILES ${SERVICE_FILES} DESTINATION "${SYSTEMD_SYSTEM_UNIT_DIR}")