瀏覽代碼

added cmake option to set the predefined service name

Malte Veerman 9 年之前
父節點
當前提交
4ecf2ac8dc
共有 2 個文件被更改,包括 10 次插入1 次删除
  1. 4 0
      CMakeLists.txt
  2. 6 1
      lib/src/systemdcommunicator.cpp

+ 4 - 0
CMakeLists.txt

@@ -10,6 +10,10 @@ option(BUILD_KCM "Build the KCM" OFF)
 option(INSTALL_SHARED "Install the shared parts" ON)
 option(INSTALL_HELPER "Install the KHelper" ON)
 
+#variables
+set(STANDARD_SERVICE_NAME "fancontrol" CACHE STRING "The name of the systemd service for the fancontrol script")
+add_definitions(-DSTANDARD_SERVICE_NAME="${STANDARD_SERVICE_NAME}")
+
 
 #KCM can't be build without systemd support
 if(BUILD_KCM AND NO_SYSTEMD)

+ 6 - 1
lib/src/systemdcommunicator.cpp

@@ -31,6 +31,11 @@
 #include <KAuth/KAuthExecuteJob>
 
 
+#ifndef STANDARD_SERVICE_NAME
+#define STANDARD_SERVICE_NAME "fancontrol"
+#endif
+
+
 typedef struct
 {
     QString path;
@@ -71,7 +76,7 @@ SystemdCommunicator::SystemdCommunicator(const QString &serviceName, QObject *pa
     m_serviceInterface(Q_NULLPTR)
 {
     if (serviceName.isEmpty())
-        setServiceName("fancontrol");
+        setServiceName(STANDARD_SERVICE_NAME);
     else 
         setServiceName(serviceName);
 }