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: I7010cdf94b37065262c1b44a1e9d5971ec1fa218
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ee48577..c0993e0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,8 +88,11 @@
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static)
+ find_package (PkgConfig REQUIRED)
+ pkg_get_variable(SYSTEMD_SYSTEM_UNIT_DIR systemd systemdsystemunitdir)
+
set(SERVICE_FILES ${PROJECT_SOURCE_DIR}/service_files/com.intel.peci.service)
- install(FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/)
+ install(FILES ${SERVICE_FILES} DESTINATION "${SYSTEMD_SYSTEM_UNIT_DIR}")
endif()