3 # where to look first for cmake modules. This line must be the first one or cmake will use the system's FindFoo.cmake
4 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules")
6 ############### Build Options ###############
8 option(KDEPIM_BUILD_EXAMPLES "Build the kdepim example applications." FALSE)
9 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)
10 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)
11 option(KDEPIM_MOBILE_UI "Build UI for mobile devices instead of for desktops" FALSE)
12 option(KDEPIM_ONLY_KLEO "Only build Kleopatra. This option will build only libkleo and kleopatra" FALSE)
13 option(KDEPIM_BUILD_STATIC "Build KDEPIM static." FALSE)
14 option(KDEPIM_BUILD_DESKTOP "Build Desktop Applications. Can be deactivated for mobile" TRUE)
15 option(KDEPIM_NO_WEBKIT "Do not use WebKit in the kdepim applications" FALSE)
17 if(KDEPIM_BUILD_STATIC)
18 set(LIBRARY_TYPE STATIC)
20 set(LIBRARY_TYPE SHARED)
23 add_definitions( -DDISABLE_NEPOMUK_LEGACY )
24 add_definitions(-DQT_USE_QSTRINGBUILDER)
26 add_definitions(-DKDEPIM_NO_WEBKIT)
29 if(KDEPIM_ENTERPRISE_BUILD)
30 message(STATUS "Enterprise build is enabled.")
33 # if KDEPIM_ONLY_KLEO is defined, KDEPIM_BUILD_MOBILE and KDEPIM_MOBILE_UI are disabled.
35 set(KDEPIM_BUILD_MOBILE FALSE)
36 set(KDEPIM_MOBILE_UI FALSE)
37 set(KDEPIM_DEFINITIONS "-DHAVE_CONFIG_H=1")
38 message(STATUS "Only libkleo and Kleopatra will be built.")
42 # Build the mobile applications
43 set(KDEPIM_BUILD_MOBILE TRUE)
46 # config-enterprise.h is needed for both ENTERPRISE_BUILD and BUILD_EVERYTHING
47 configure_file(config-enterprise.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-enterprise.h )
49 ############### generate kdepim-version.h ###############
50 # Support for the GIT revision number in kdepim-version.h
51 if(EXISTS "${kdepim_SOURCE_DIR}/.git")
54 message(STATUS "Found git: ${GIT_EXECUTABLE}")
55 execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
56 WORKING_DIRECTORY ${kdepim_SOURCE_DIR}
57 OUTPUT_VARIABLE kdepim_git_revision)
58 string(REGEX REPLACE "\n" "" kdepim_git_revision "${kdepim_git_revision}")
59 set(kdepim_git_revision "git-${kdepim_git_revision}")
61 execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --oneline --format=%ci
62 WORKING_DIRECTORY ${kdepim_SOURCE_DIR}
63 OUTPUT_VARIABLE kdepim_git_last_change)
64 string(REGEX REPLACE " [-0-9:+ ]*\n" "" kdepim_git_last_change "${kdepim_git_last_change}")
69 # Version scheme: "x.y.z build".
71 # x is the version number.
72 # y is the major release number.
73 # z is the minor release number.
75 # "x.y.z" follow the kdelibs version kdepim is released with.
77 # If "z" is 0, the version is "x.y"
79 # KDEPIM_DEV_VERSION is empty for final versions.
80 # For development versions "build" is something like "pre", "alpha1", "alpha2", "beta1", "beta2", "rc1", "rc2".
82 # Examples in chronological order:
83 # 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
86 set(KDEPIM_DEV_VERSION pre)
89 if(DEFINED KDEPIM_DEV_VERSION)
90 set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}")
93 set(KDEPIM_VERSION "4.13${KDEPIM_DEV_VERSION}")
95 configure_file(kdepim-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdepim-version.h @ONLY)
99 ############### search packages used by KDE ###############
101 find_package(KDE4 4.11.3 REQUIRED)
102 include(KDE4Defaults)
104 find_package(KdepimLibs 4.12.42)
105 set_package_properties(KdepimLibs PROPERTIES DESCRIPTION "The KDEPIM libraries" URL "http://www.kde.org" TYPE REQUIRED)
107 ############### Load the CTest options ###############
109 # CMake is irritating and doesn't allow setting the tests timeout globally.
110 # Let's work around this. The global timeout is now 2 minutes.
111 set(_DartConfigFile "${CMAKE_BINARY_DIR}/DartConfiguration.tcl")
112 if(EXISTS ${_DartConfigFile})
113 set(DartTestingTimeout "120")
114 file(READ ${_DartConfigFile} _DartConfigFile_content)
115 string(REGEX REPLACE "TimeOut: 1500" "TimeOut: ${DartTestingTimeout}" _DartConfigFile_content ${_DartConfigFile_content})
116 file(WRITE ${_DartConfigFile} ${_DartConfigFile_content})
119 # CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
120 # in the KDE build system, this is the same as CMAKE_BINARY_DIR.
121 configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
123 ############### search Boost ###############
125 find_package(Boost 1.34.0)
126 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")
128 # Kleopatra needs to know if the topological.hpp header exists (part of Boost_graph).
129 find_path(Boost_TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
130 if(Boost_TOPOLOGICAL_SORT_DIR)
131 message(STATUS "The Boost Topological_sort header was found. Building Kleopatra")
133 message(STATUS "The Boost Topological_sort header was NOT found. Kleopatra will not be built")
136 ############### Windows specific ###############
139 # detect oxygen icon dir at configure time based on KDEDIRS - there may be different package installation locations
140 execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
141 file(TO_CMAKE_PATH "${_dir}" __dir)
142 find_path(KDE4_ICON_DIR oxygen PATHS
145 message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")
147 set (KDE4_ICON_DIR ${CMAKE_INSTALL_PREFIX}/share/icons)
150 ############### ONLY_KLEO ###############
152 # If the KDEPIM_ONLY_KLEO option is true
155 set_package_properties(QGpgme PROPERTIES DESCRIPTION "The QGpgME library" URL "http://www.kde.org" TYPE REQUIRED PURPOSE "QGpgME is required to build Kleopatra.")
157 add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS})
158 include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIRS} ${QT_QTDBUS_INCLUDE_DIR})
159 include(kleopatra/ConfigureChecks.cmake)
161 add_subdirectory(libkleo)
162 if(Boost_TOPOLOGICAL_SORT_DIR)
163 add_subdirectory(kleopatra)
168 ############### Find the stuff we need ###############
170 find_package(Akonadi 1.10.45 QUIET CONFIG)
171 set_package_properties(Akonadi PROPERTIES DESCRIPTION "Akonadi server libraries" URL "http://pim.kde.org/akonadi" TYPE REQUIRED PURPOSE "Akonadi is required to build KDEPIM")
174 set_package_properties(ZLIB PROPERTIES DESCRIPTION "The Zlib compression library" URL "http://www.zlib.net" TYPE REQUIRED)
177 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")
179 find_package(SharedDesktopOntologies 0.11)
180 set_package_properties(SharedDesktopOntologies PROPERTIES DESCRIPTION "Shared Desktop Ontologies" URL "http://sourceforge.net/projects/oscaf/" TYPE REQUIRED PURPOSE "Ontologies necessary for the Nepomuk semantic desktop")
182 find_package(Soprano 2.9.0)
183 set_package_properties(Soprano PROPERTIES DESCRIPTION "C++/Qt4 framework for RDF data" URL "http://soprano.sourceforge.net" TYPE REQUIRED PURPOSE "Storage of semantic data")
184 include(SopranoAddOntology)
186 find_package(Grantlee 0.3.0 QUIET CONFIG)
187 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)." )
189 find_package(NepomukCore QUIET CONFIG)
190 set_package_properties(NepomukCore PROPERTIES DESCRIPTION "The Nepomuk Core libraries" URL "http://www.kde.org" TYPE REQUIRED PURPOSE "Nepomuk extends the search and tagging functionalities in KMail and Akonadi")
192 find_package(NepomukWidgets QUIET CONFIG)
193 set_package_properties(NepomukWidgets PROPERTIES DESCRIPTION "The NepomukWidget libraries" URL "http://www.kde.org" TYPE RECOMMENDED PURPOSE "Nepomuk-widgets is needed for building Akonadiconsole")
195 find_package(Baloo QUIET CONFIG)
196 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")
199 find_package(Xsltproc)
200 set_package_properties(Xsltproc PROPERTIES DESCRIPTION "XSLT processor from libxslt" TYPE REQUIRED PURPOSE "Required to generate D-Bus interfaces.")
203 set_package_properties(QJSON PROPERTIES DESCRIPTION "QJSON" URL "http://qjson.sourceforge.net/" TYPE REQUIRED PURPOSE "Qt library for handling JSON data")
205 find_package(Prison QUIET CONFIG)
206 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")
209 find_package(LibKGAPI2 2.0.80 QUIET CONFIG)
210 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 Akonadi resources to access Google Contacts, Calendars and Tasks")
212 if( LibKGAPI2_FOUND )
213 add_definitions( -DKDEPIM_STORAGESERVICE_GDRIVE )
218 ############### Desktop vs. Mobile options ##############
221 add_definitions( -DKDEPIM_MOBILE_UI )
222 if(NOT QT_QTDECLARATIVE_FOUND)
223 message(FATAL_ERROR "The QtDeclarative (QML) module is required for building the mobile UI")
226 if(NOT QT_QTDECLARATIVE_FOUND)
227 message(STATUS "The Qt Declarative (QML) module was not found. The mobile applications will not be built.")
228 set(KDEPIM_BUILD_MOBILE FALSE)
232 ############### Needed commands before building anything ###############
234 add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS} ${AKONADI_DEFINITIONS})
236 include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
238 if(NOT KDEPIMLIBS_KRESOURCES_LIBRARY)
239 add_definitions( -DKDEPIM_NO_KRESOURCES )
243 ############### Now, we add the PIM components ###############
245 include (kleopatra/ConfigureChecks.cmake)
247 # These targets will always be built before anything else.
249 add_subdirectory(ontologies) # must be the first one.
250 add_subdirectory(noteshared)
251 add_subdirectory(akonadi_next)
252 add_subdirectory(libkdepim)
253 add_subdirectory(calendarsupport)
254 add_subdirectory(calendarviews)
255 add_subdirectory(incidenceeditor-ng)
256 add_subdirectory(libkdepimdbusinterfaces)
257 add_subdirectory(libkleo)
258 add_subdirectory(libkpgp)
259 add_subdirectory(libksieve)
260 add_subdirectory(kdgantt2)
261 add_subdirectory(icons)
262 add_subdirectory(composereditor-ng)
263 add_subdirectory(grammar)
264 add_subdirectory(messagecore)
265 add_subdirectory(grantleetheme)
266 add_subdirectory(messagelist)
267 add_subdirectory(templateparser)
270 if(Boost_TOPOLOGICAL_SORT_DIR)
271 macro_optional_add_subdirectory(kleopatra)
275 # The following components depend on QGpgME.
276 add_subdirectory(messageviewer)
277 macro_optional_add_subdirectory(messagecomposer)
278 add_subdirectory(pimcommon)
279 add_subdirectory(mailcommon) # TODO: does this make sense?!?
280 macro_optional_add_subdirectory(kmail)
281 macro_optional_add_subdirectory(headerthemeeditor)
282 macro_optional_add_subdirectory(contactthemeeditor)
283 add_subdirectory(grantleethemeeditor)
285 if(KDEPIM_BUILD_MOBILE)
286 add_subdirectory(mobile)
289 if(KDEPIM_BUILD_EXAMPLES)
290 add_subdirectory(examples)
293 # If kmail is compiled, KMAIL_SUPPORTED is true (used in several places)
295 set(KMAIL_SUPPORTED TRUE)
296 add_definitions(-DKMAIL_SUPPORTED)
299 macro_optional_add_subdirectory(pimactivity)
300 macro_optional_add_subdirectory(korganizer)
301 macro_optional_add_subdirectory(korgac)
302 macro_optional_add_subdirectory(sieveeditor)
303 macro_optional_add_subdirectory(storageservicemanager)
304 add_subdirectory(kaddressbookgrantlee)
305 if(KDEPIM_BUILD_DESKTOP)
306 macro_optional_add_subdirectory(agents)
307 macro_optional_add_subdirectory(akregator)
308 macro_optional_add_subdirectory(importwizard)
309 macro_optional_add_subdirectory(kaddressbook)
310 macro_optional_add_subdirectory(kmailcvt)
311 macro_optional_add_subdirectory(mboximporter)
312 macro_optional_add_subdirectory(knotes)
313 macro_optional_add_subdirectory(ksendemail)
314 macro_optional_add_subdirectory(ktnef)
315 macro_optional_add_subdirectory(mailimporter)
316 macro_optional_add_subdirectory(pimsettingexporter)
317 macro_optional_add_subdirectory(kalarm)
319 if(KDEPIMLIBS_KCAL_LIBRARY)
320 macro_optional_add_subdirectory(blogilo)
323 macro_optional_add_subdirectory(kjots)
325 if(KDEPIMLIBS_KRESOURCES_LIBRARY)
326 if(QT_QT3SUPPORT_FOUND)
327 macro_optional_add_subdirectory(knode)
331 macro_optional_add_subdirectory(ktimetracker)
335 macro_optional_add_subdirectory(kontact) # must be the last one.
338 if(NepomukWidgets_FOUND)
339 macro_optional_add_subdirectory(akonadiconsole)
341 macro_optional_add_subdirectory(console)
343 # These targets depend on optional applications
344 if(KDEPIMLIBS_KRESOURCES_LIBRARY)
345 add_subdirectory(kresources) # Must be after KAddressbook
348 add_subdirectory(plugins) # Must be after KMail
352 # doc must be a subdir of kdepim or packagers will kill us
353 macro_optional_add_subdirectory(doc)
355 # All done, let's display what we found...
356 feature_summary(WHAT ALL
357 INCLUDE_QUIET_PACKAGES
358 FATAL_ON_MISSING_REQUIRED_PACKAGES