forked from kolab-groupware/kdepim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
347 lines (274 loc) · 13.3 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
project(kdepim)
# where to look first for cmake modules. This line must be the first one or cmake will use the system's FindFoo.cmake
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules")
############### Build Options ###############
option(KDEPIM_BUILD_EXAMPLES "Build the kdepim example applications." FALSE)
option(KDEPIM_BUILD_MOBILE "Build the mobile applications. Note that you have to enable KDEPIM_MOBILE_UI if you want to run these applications on a mobile device." TRUE)
option(KDEPIM_ENTERPRISE_BUILD "Enable features specific to the enterprise branch, which are normally disabled. Also, it disables many components not needed for Kontact such as the Kolab client." FALSE)
option(KDEPIM_MOBILE_UI "Build UI for mobile devices instead of for desktops" FALSE)
option(KDEPIM_ONLY_KLEO "Only build Kleopatra. This option will build only libkleo and kleopatra" FALSE)
option(KDEPIM_BUILD_STATIC "Build KDEPIM static." FALSE)
option(KDEPIM_BUILD_DESKTOP "Build Desktop Applications. Can be deactivated for mobile" TRUE)
option(KDEPIM_NO_WEBKIT "Do not use WebKit in the kdepim applications" FALSE)
if(KDEPIM_BUILD_STATIC)
set(LIBRARY_TYPE STATIC)
else()
set(LIBRARY_TYPE SHARED)
endif()
add_definitions(-DQT_USE_QSTRINGBUILDER)
if(KDEPIM_NO_WEBKIT)
add_definitions(-DKDEPIM_NO_WEBKIT)
endif()
if(KDEPIM_ENTERPRISE_BUILD)
message(STATUS "Enterprise build is enabled.")
endif()
# if KDEPIM_ONLY_KLEO is defined, KDEPIM_BUILD_MOBILE and KDEPIM_MOBILE_UI are disabled.
if(KDEPIM_ONLY_KLEO)
set(KDEPIM_BUILD_MOBILE FALSE)
set(KDEPIM_MOBILE_UI FALSE)
set(KDEPIM_DEFINITIONS "-DHAVE_CONFIG_H=1")
message(STATUS "Only libkleo and Kleopatra will be built.")
endif()
if(KDEPIM_MOBILE_UI)
# Build the mobile applications
set(KDEPIM_BUILD_MOBILE TRUE)
endif()
# config-enterprise.h is needed for both ENTERPRISE_BUILD and BUILD_EVERYTHING
configure_file(config-enterprise.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-enterprise.h )
############### generate kdepim-version.h ###############
# Support for the GIT revision number in kdepim-version.h
if(EXISTS "${kdepim_SOURCE_DIR}/.git")
find_package(Git)
if(GIT_FOUND)
message(STATUS "Found git: ${GIT_EXECUTABLE}")
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${kdepim_SOURCE_DIR}
OUTPUT_VARIABLE kdepim_git_revision)
string(REGEX REPLACE "\n" "" kdepim_git_revision "${kdepim_git_revision}")
set(kdepim_git_revision "git-${kdepim_git_revision}")
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --oneline --format=%ci
WORKING_DIRECTORY ${kdepim_SOURCE_DIR}
OUTPUT_VARIABLE kdepim_git_last_change)
string(REGEX REPLACE " [-0-9:+ ]*\n" "" kdepim_git_last_change "${kdepim_git_last_change}")
endif()
endif()
# KDEPIM_VERSION
# Version scheme: "x.y.z build".
#
# x is the version number.
# y is the major release number.
# z is the minor release number.
#
# "x.y.z" follow the kdelibs version kdepim is released with.
#
# If "z" is 0, the version is "x.y"
#
# KDEPIM_DEV_VERSION is empty for final versions.
# For development versions "build" is something like "pre", "alpha1", "alpha2", "beta1", "beta2", "rc1", "rc2".
#
# Examples in chronological order:
# 3.0, 3.0.1, 3.1 alpha1, 3.1 beta1, 3.1 beta2, 3.1 rc1, 3.1, 3.1.1, 3.2 pre, 3.2 alpha1
set(KDEPIM_VERSION_MAJOR 4)
set(KDEPIM_VERSION_MINOR 13)
set(KDEPIM_VERSION_PATCH 0)
set(KDEPIM_VERSION_KOLAB 0)
set(KDEPIM_VERSION ${KDEPIM_VERSION_MAJOR}.${KDEPIM_VERSION_MINOR}.${KDEPIM_VERSION_PATCH}.${KDEPIM_VERSION_KOLAB})
configure_file(kdepim-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdepim-version.h @ONLY)
set(CMAKE_AUTOMOC ON)
############### search packages used by KDE ###############
find_package(KDE4 4.11.3 REQUIRED)
include(KDE4Defaults)
find_package(KdepimLibs 4.13.0)
set_package_properties(KdepimLibs PROPERTIES DESCRIPTION "The KDEPIM libraries" URL "http://www.kde.org" TYPE REQUIRED)
############### Load the CTest options ###############
# CMake is irritating and doesn't allow setting the tests timeout globally.
# Let's work around this. The global timeout is now 2 minutes.
set(_DartConfigFile "${CMAKE_BINARY_DIR}/DartConfiguration.tcl")
if(EXISTS ${_DartConfigFile})
set(DartTestingTimeout "120")
file(READ ${_DartConfigFile} _DartConfigFile_content)
string(REGEX REPLACE "TimeOut: 1500" "TimeOut: ${DartTestingTimeout}" _DartConfigFile_content ${_DartConfigFile_content})
file(WRITE ${_DartConfigFile} ${_DartConfigFile_content})
endif()
# CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
# in the KDE build system, this is the same as CMAKE_BINARY_DIR.
configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
############### search Boost ###############
find_package(Boost 1.34.0)
set_package_properties(Boost PROPERTIES DESCRIPTION "Boost C++ Libraries" URL "http://www.boost.org" TYPE REQUIRED PURPOSE "Boost is required for building most KDEPIM applications")
# Kleopatra needs to know if the topological.hpp header exists (part of Boost_graph).
find_path(Boost_TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
if(Boost_TOPOLOGICAL_SORT_DIR)
message(STATUS "The Boost Topological_sort header was found. Building Kleopatra")
else()
message(STATUS "The Boost Topological_sort header was NOT found. Kleopatra will not be built")
endif()
############### Windows specific ###############
if(WIN32)
# detect oxygen icon dir at configure time based on KDEDIRS - there may be different package installation locations
execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
file(TO_CMAKE_PATH "${_dir}" __dir)
find_path(KDE4_ICON_DIR oxygen PATHS
${__dir}
)
message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")
else()
set (KDE4_ICON_DIR ${CMAKE_INSTALL_PREFIX}/share/icons)
endif()
############### ONLY_KLEO ###############
# If the KDEPIM_ONLY_KLEO option is true
if(KDEPIM_ONLY_KLEO)
find_package(QGpgme)
set_package_properties(QGpgme PROPERTIES DESCRIPTION "The QGpgME library" URL "http://www.kde.org" TYPE REQUIRED PURPOSE "QGpgME is required to build Kleopatra.")
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS})
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIRS} ${QT_QTDBUS_INCLUDE_DIR})
include(kleopatra/ConfigureChecks.cmake)
add_subdirectory(libkleo)
if(Boost_TOPOLOGICAL_SORT_DIR)
add_subdirectory(kleopatra)
endif()
else()
# Otherwise...
############### Find the stuff we need ###############
# Akonadi
find_package(Akonadi 1.12.0 QUIET CONFIG)
set_package_properties(Akonadi PROPERTIES DESCRIPTION "Akonadi server libraries" URL "http://pim.kde.org/akonadi" TYPE REQUIRED PURPOSE "Akonadi is required to build KDEPIM")
find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES DESCRIPTION "The Zlib compression library" URL "http://www.zlib.net" TYPE REQUIRED)
find_package(QGpgme)
set_package_properties(QGpgme PROPERTIES DESCRIPTION "The QGpgMe library" URL "http://www.kde.org" TYPE RECOMMENDED PURPOSE "QGpgME is required to build KMail, KOrganizer and Kleopatra")
find_package(Grantlee 0.3.0 QUIET CONFIG)
set_package_properties(Grantlee PROPERTIES DESCRIPTION "The Grantlee Template System" URL "http://www.gitorious.org/grantlee/pages/Home" TYPE REQUIRED PURPOSE "Grantlee is requires for kmail and templating, theming for KJots, KaddressBook, KNotes and MessageViewer(KMail)." )
find_package(Baloo 4.13.0 QUIET CONFIG)
set_package_properties(Baloo PROPERTIES DESCRIPTION "The Baloo libraries" URL "http://www.kde.org" TYPE REQUIRED PURPOSE "Baloo provides search capabilities in KMail and Akonadi")
# Xsltproc
find_package(Xsltproc)
set_package_properties(Xsltproc PROPERTIES DESCRIPTION "XSLT processor from libxslt" TYPE REQUIRED PURPOSE "Required to generate D-Bus interfaces.")
find_package(QJSON)
set_package_properties(QJSON PROPERTIES DESCRIPTION "QJSON" URL "http://qjson.sourceforge.net/" TYPE REQUIRED PURPOSE "Qt library for handling JSON data")
find_package(Prison QUIET CONFIG)
set_package_properties(Prison PROPERTIES DESCRIPTION "The Prison library" URL "http://projects.kde.org/prison" TYPE OPTIONAL PURPOSE "Needed to show mobile barcodes of your contacts")
# Libkgapi2
find_package(LibKGAPI2 2.1.0 QUIET CONFIG)
set_package_properties(LibKGAPI2 PROPERTIES DESCRIPTION "KDE-based library for accessing various Google services" URL "https://projects.kde.org/libkgapi" TYPE OPTIONAL PURPOSE "LibKGAPI is required to build Google Drive Storage Service")
# shared-mime-info
find_package(SharedMimeInfo 0.30)
set_package_properties(SharedMimeInfo PROPERTIES DESCRIPTION "The shared-mime-info utility" URL "http://freedesktop.org/wiki/Software/shared-mime-info" TYPE REQUIRED PURPOSE "Information about filetypes")
if( LibKGAPI2_FOUND )
add_definitions( -DKDEPIM_STORAGESERVICE_GDRIVE )
endif()
############### Desktop vs. Mobile options ##############
if(KDEPIM_MOBILE_UI)
add_definitions( -DKDEPIM_MOBILE_UI )
if(NOT QT_QTDECLARATIVE_FOUND)
message(FATAL_ERROR "The QtDeclarative (QML) module is required for building the mobile UI")
endif()
else()
if(NOT QT_QTDECLARATIVE_FOUND)
message(STATUS "The Qt Declarative (QML) module was not found. The mobile applications will not be built.")
set(KDEPIM_BUILD_MOBILE FALSE)
endif()
endif()
############### Needed commands before building anything ###############
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS} ${AKONADI_DEFINITIONS})
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
if(NOT KDEPIMLIBS_KRESOURCES_LIBRARY)
add_definitions( -DKDEPIM_NO_KRESOURCES )
endif()
############### Now, we add the PIM components ###############
include (kleopatra/ConfigureChecks.cmake)
# These targets will always be built before anything else.
add_subdirectory(accountwizard)
add_subdirectory(noteshared)
add_subdirectory(akonadi_next)
add_subdirectory(libkdepim)
add_subdirectory(calendarsupport)
add_subdirectory(calendarviews)
add_subdirectory(incidenceeditor-ng)
add_subdirectory(libkdepimdbusinterfaces)
add_subdirectory(libkleo)
add_subdirectory(libkpgp)
add_subdirectory(libksieve)
add_subdirectory(kdgantt2)
add_subdirectory(icons)
add_subdirectory(composereditor-ng)
add_subdirectory(grammar)
add_subdirectory(messagecore)
add_subdirectory(grantleetheme)
add_subdirectory(messagelist)
add_subdirectory(templateparser)
if(QGPGME_FOUND)
if(Boost_TOPOLOGICAL_SORT_DIR)
macro_optional_add_subdirectory(kleopatra)
endif()
endif()
# The following components depend on QGpgME.
add_subdirectory(messageviewer)
macro_optional_add_subdirectory(messagecomposer)
add_subdirectory(pimcommon)
add_subdirectory(mailcommon) # TODO: does this make sense?!?
macro_optional_add_subdirectory(kmail)
macro_optional_add_subdirectory(headerthemeeditor)
macro_optional_add_subdirectory(contactthemeeditor)
add_subdirectory(grantleethemeeditor)
if(KDEPIM_BUILD_MOBILE)
add_subdirectory(mobile)
endif()
if(KDEPIM_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
# If kmail is compiled, KMAIL_SUPPORTED is true (used in several places)
if(BUILD_kmail)
set(KMAIL_SUPPORTED TRUE)
add_definitions(-DKMAIL_SUPPORTED)
endif()
macro_optional_add_subdirectory(pimactivity)
macro_optional_add_subdirectory(korganizer)
macro_optional_add_subdirectory(korgac)
macro_optional_add_subdirectory(sieveeditor)
macro_optional_add_subdirectory(storageservicemanager)
add_subdirectory(kaddressbookgrantlee)
if(KDEPIM_BUILD_DESKTOP)
macro_optional_add_subdirectory(agents)
macro_optional_add_subdirectory(akregator)
macro_optional_add_subdirectory(importwizard)
macro_optional_add_subdirectory(kaddressbook)
macro_optional_add_subdirectory(kmailcvt)
macro_optional_add_subdirectory(mboximporter)
if (NOT WIN32)
macro_optional_add_subdirectory(knotes)
endif()
macro_optional_add_subdirectory(ksendemail)
macro_optional_add_subdirectory(ktnef)
macro_optional_add_subdirectory(mailimporter)
macro_optional_add_subdirectory(pimsettingexporter)
macro_optional_add_subdirectory(kalarm)
if(KDEPIMLIBS_KCAL_LIBRARY)
macro_optional_add_subdirectory(blogilo)
endif()
macro_optional_add_subdirectory(kjots)
if(KDEPIMLIBS_KRESOURCES_LIBRARY)
if(QT_QT3SUPPORT_FOUND)
macro_optional_add_subdirectory(knode)
endif()
if(Q_WS_X11)
macro_optional_add_subdirectory(ktimetracker)
endif()
endif()
macro_optional_add_subdirectory(kontact) # must be the last one.
endif()
macro_optional_add_subdirectory(akonadiconsole)
macro_optional_add_subdirectory(console)
# These targets depend on optional applications
if(KDEPIMLIBS_KRESOURCES_LIBRARY)
add_subdirectory(kresources) # Must be after KAddressbook
endif()
add_subdirectory(plugins) # Must be after KMail
endif()
# doc must be a subdir of kdepim or packagers will kill us
macro_optional_add_subdirectory(doc)
# All done, let's display what we found...
feature_summary(WHAT ALL
INCLUDE_QUIET_PACKAGES
FATAL_ON_MISSING_REQUIRED_PACKAGES
)