-
Notifications
You must be signed in to change notification settings - Fork 32
/
CMakeLists.txt
143 lines (90 loc) · 3.23 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
cmake_minimum_required(VERSION 3.0.2)
project(fancontroller)
set(QT_MIN_VERSION "5.8.0")
#options
option(NO_SYSTEMD "Compile without Systemd support. Reduces functionality significantly!" OFF)
option(BUILD_GUI "Build the standalone application" ON)
option(BUILD_KCM "Build the KCM" OFF)
option(BUILD_PLASMOID "Build the plasmoid" OFF)
option(BUILD_HELPER "Build the KHelper" ON)
option(INSTALL_SHARED "Install the shared parts" ON)
option(INSTALL_POLKIT "Install polkit files and rules" OFF)
#variables
set(STANDARD_SERVICE_NAME "fancontrol" CACHE STRING "The name of the systemd service for the fancontrol script")
set(STANDARD_CONFIG_FILE "/etc/fancontrol" CACHE STRING "The location of the standard config file for the fancontrol script")
set(STANDARD_HELPER_ID "org.kde.fancontrol.gui.helper" CACHE STRING "The standard id for the KAuth helper")
set(POLKIT_GROUP_NAME "fancontrol" CACHE STRING "The group which is granted elevated permissions by polkit to manipulate fancontrol")
add_definitions(-DSTANDARD_SERVICE_NAME="${STANDARD_SERVICE_NAME}")
add_definitions(-DSTANDARD_CONFIG_FILE="${STANDARD_CONFIG_FILE}")
add_definitions(-DSTANDARD_HELPER_ID="${STANDARD_HELPER_ID}")
#KCM can't be build without systemd support
if(BUILD_KCM AND NO_SYSTEMD)
message(WARNING "KCM can't be build without systemd support")
set(BUILD_KCM FALSE)
endif(BUILD_KCM AND NO_SYSTEMD)
#Silence warnings
cmake_policy(SET CMP0063 NEW)
#Find ECM
find_package(ECM 5.38 REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
#includes
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
include(FeatureSummary)
include(FindPkgConfig)
include(ECMQMLModules)
#Find Qt5
find_package(Qt5Core ${QT_MIN_VERSION} REQUIRED)
#Find KF5
find_package(KF5 COMPONENTS I18n REQUIRED)
#Find QML modules
ecm_find_qmlmodule(QtQuick 2.6)
ecm_find_qmlmodule(QtQuick.Controls 2.1)
ecm_find_qmlmodule(QtQuick.Layouts 1.2)
ecm_find_qmlmodule(QtQuick.Dialogs 1.2)
ecm_find_qmlmodule(org.kde.kirigami 2.3)
include_directories (${CMAKE_SOURCE_DIR})
#Systemd
if(NOT NO_SYSTEMD)
message(STATUS "Compiling for Systemd")
else(NOT NO_SYSTEMD)
message(STATUS "Compiling without Systemd")
set(NO_SYSTEMD true)
add_definitions(-DNO_SYSTEMD)
endif(NOT NO_SYSTEMD)
#KHelper for actions that require superuser rights
if(BUILD_HELPER)
add_subdirectory(helper)
endif(BUILD_HELPER)
#Build the standalone application
if(BUILD_GUI)
message(STATUS "Build the standalone application")
add_subdirectory(fancontrol-gui)
endif(BUILD_GUI)
#Build the KCM
if(BUILD_KCM)
message(STATUS "Build the KCM")
add_subdirectory(kcm)
endif(BUILD_KCM)
#Build the plasmoid
if(BUILD_PLASMOID)
message(STATUS "Build the plasmoid")
add_subdirectory(plasmoid)
endif(BUILD_PLASMOID)
#build and install the shared parts
if(INSTALL_SHARED)
#qml plugin
add_subdirectory(import)
#icon
include(ECMInstallIcons)
ecm_install_icons(ICONS sc-apps-org.kde.fancontrol.gui.svg DESTINATION "${KDE_INSTALL_ICONDIR}")
#translations
ki18n_install(po)
endif(INSTALL_SHARED)
#install polkit files
if(INSTALL_POLKIT)
add_subdirectory(polkit)
endif(INSTALL_POLKIT)
#summary
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)