SVN_SILENT made messages (.desktop file)
[kdepim.git] / CMakeLists.txt
blob49b6e9adb7be6d379046559945e82d81f8dfbc0e
1 project(kdepim)
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)
19 else()
20   set(LIBRARY_TYPE SHARED)
21 endif()
23 add_definitions(-DQT_USE_QSTRINGBUILDER)
24 if(KDEPIM_NO_WEBKIT)
25   add_definitions(-DKDEPIM_NO_WEBKIT)
26 endif()
28 if(KDEPIM_ENTERPRISE_BUILD)
29   message(STATUS "Enterprise build is enabled.")
30 endif()
32 # if KDEPIM_ONLY_KLEO is defined, KDEPIM_BUILD_MOBILE and KDEPIM_MOBILE_UI are disabled.
33 if(KDEPIM_ONLY_KLEO)
34  set(KDEPIM_BUILD_MOBILE FALSE)
35  set(KDEPIM_MOBILE_UI FALSE)
36  set(KDEPIM_DEFINITIONS "-DHAVE_CONFIG_H=1")
37  message(STATUS "Only libkleo and Kleopatra will be built.")
38 endif()
40 if(KDEPIM_MOBILE_UI)
41     # Build the mobile applications
42     set(KDEPIM_BUILD_MOBILE TRUE)
43 endif()
45 # config-enterprise.h is needed for both ENTERPRISE_BUILD and BUILD_EVERYTHING
46 configure_file(config-enterprise.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-enterprise.h )
48 ############### generate kdepim-version.h ###############
49 # Support for the GIT revision number in kdepim-version.h
50 if(EXISTS "${kdepim_SOURCE_DIR}/.git")
51   find_package(Git)
52   if(GIT_FOUND)
53     message(STATUS "Found git: ${GIT_EXECUTABLE}")
54     execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
55                     WORKING_DIRECTORY ${kdepim_SOURCE_DIR}
56                     OUTPUT_VARIABLE kdepim_git_revision)
57     string(REGEX REPLACE "\n" "" kdepim_git_revision "${kdepim_git_revision}")
58     set(kdepim_git_revision "git-${kdepim_git_revision}")
60     execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --oneline --format=%ci
61                     WORKING_DIRECTORY ${kdepim_SOURCE_DIR}
62                     OUTPUT_VARIABLE kdepim_git_last_change)
63     string(REGEX REPLACE " [-0-9:+ ]*\n" "" kdepim_git_last_change "${kdepim_git_last_change}")
64   endif()
65 endif()
67 # KDEPIM_VERSION
68 # Version scheme: "x.y.z build".
70 # x is the version number.
71 # y is the major release number.
72 # z is the minor release number.
74 # "x.y.z" follow the kdelibs version kdepim is released with.
76 # If "z" is 0, the version is "x.y"
78 # KDEPIM_DEV_VERSION is empty for final versions.
79 # For development versions "build" is something like "pre", "alpha1", "alpha2", "beta1", "beta2", "rc1", "rc2".
81 # Examples in chronological order:
82 # 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
84 # Do NOT add quote
85 set(KDEPIM_DEV_VERSION pre)
87 # add an extra space
88 if(DEFINED KDEPIM_DEV_VERSION)
89   set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}")
90 endif()
92 set(KDEPIM_VERSION "4.14${KDEPIM_DEV_VERSION}")
94 configure_file(kdepim-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdepim-version.h @ONLY)
96 set(CMAKE_AUTOMOC ON)
98 ############### search packages used by KDE ###############
100 find_package(KDE4 4.12.0 REQUIRED)
101 include(KDE4Defaults)
103 find_package(KdepimLibs 4.13.47)
104 set_package_properties(KdepimLibs PROPERTIES DESCRIPTION "The KDEPIM libraries" URL "http://www.kde.org" TYPE REQUIRED)
106 ############### Load the CTest options ###############
108 # CMake is irritating and doesn't allow setting the tests timeout globally.
109 # Let's work around this. The global timeout is now 2 minutes.
110 set(_DartConfigFile "${CMAKE_BINARY_DIR}/DartConfiguration.tcl")
111 if(EXISTS ${_DartConfigFile})
112   set(DartTestingTimeout "120")
113   file(READ ${_DartConfigFile} _DartConfigFile_content)
114   string(REGEX REPLACE "TimeOut: 1500" "TimeOut: ${DartTestingTimeout}" _DartConfigFile_content ${_DartConfigFile_content})
115   file(WRITE ${_DartConfigFile} ${_DartConfigFile_content})
116 endif()
118 # CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
119 # in the KDE build system, this is the same as CMAKE_BINARY_DIR.
120 configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
122 ############### search Boost ###############
124 find_package(Boost 1.34.0)
125 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")
127 # Kleopatra needs to know if the topological.hpp header exists (part of Boost_graph).
128 find_path(Boost_TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
129 if(Boost_TOPOLOGICAL_SORT_DIR)
130   message(STATUS "The Boost Topological_sort header was found. Building Kleopatra")
131 else()
132   message(STATUS "The Boost Topological_sort header was NOT found. Kleopatra will not be built")
133 endif()
135 ############### Windows specific ###############
137 if(WIN32)
138   # detect oxygen icon dir at configure time based on KDEDIRS - there may be different package installation locations
139   execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
140   file(TO_CMAKE_PATH "${_dir}" __dir)
141   find_path(KDE4_ICON_DIR oxygen PATHS
142     ${__dir}
143   )
144   message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")
145 else()
146     set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
147 endif()
149 ############### ONLY_KLEO ###############
151 # If the KDEPIM_ONLY_KLEO option is true
152 if(KDEPIM_ONLY_KLEO)
153   find_package(QGpgme)
154   set_package_properties(QGpgme PROPERTIES DESCRIPTION "The QGpgME library" URL "http://www.kde.org" TYPE REQUIRED PURPOSE "QGpgME is required to build Kleopatra.")
156   add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS})
157   include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIRS} ${QT_QTDBUS_INCLUDE_DIR})
158   include(kleopatra/ConfigureChecks.cmake)
160   add_subdirectory(libkleo)
161   if(Boost_TOPOLOGICAL_SORT_DIR)
162     add_subdirectory(kleopatra)
163   endif()
164 else()
166 # Otherwise...
167 ############### Find the stuff we need ###############
168   # Akonadi
169   find_package(Akonadi 1.12.1 QUIET CONFIG)
170   set_package_properties(Akonadi PROPERTIES DESCRIPTION "Akonadi server libraries" URL "http://pim.kde.org/akonadi" TYPE REQUIRED PURPOSE "Akonadi is required to build KDEPIM")
172   find_package(ZLIB)
173   set_package_properties(ZLIB PROPERTIES DESCRIPTION "The Zlib compression library" URL "http://www.zlib.net" TYPE REQUIRED)
175   find_package(QGpgme)
176   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")
178   find_package(Grantlee 0.3.0 QUIET CONFIG)
179   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)." )
181   find_package(Baloo 4.13.43 QUIET CONFIG)
182   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")
184   # Xsltproc
185   find_package(Xsltproc)
186   set_package_properties(Xsltproc PROPERTIES DESCRIPTION "XSLT processor from libxslt" TYPE REQUIRED PURPOSE "Required to generate D-Bus interfaces.")
188   find_package(QJSON)
189   set_package_properties(QJSON PROPERTIES DESCRIPTION "QJSON" URL "http://qjson.sourceforge.net/" TYPE REQUIRED PURPOSE "Qt library for handling JSON data")
191   find_package(Prison QUIET CONFIG)
192   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")
194   # Libkgapi2
195   find_package(LibKGAPI2 2.1.0 QUIET CONFIG)
196   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")
198   if( LibKGAPI2_FOUND )
199     add_definitions( -DKDEPIM_STORAGESERVICE_GDRIVE )
200   endif()
204 ############### Desktop vs. Mobile options ##############
206   if(KDEPIM_MOBILE_UI)
207     add_definitions( -DKDEPIM_MOBILE_UI )
208     if(NOT QT_QTDECLARATIVE_FOUND)
209       message(FATAL_ERROR "The QtDeclarative (QML) module is required for building the mobile UI")
210     endif()
211   else()
212     if(NOT QT_QTDECLARATIVE_FOUND)
213       message(STATUS "The Qt Declarative (QML) module was not found. The mobile applications will not be built.")
214       set(KDEPIM_BUILD_MOBILE FALSE)
215     endif()
216   endif()
218 ############### Needed commands before building anything ###############
220   add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS} ${AKONADI_DEFINITIONS})
222   include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
224   if(NOT KDEPIMLIBS_KRESOURCES_LIBRARY)
225     add_definitions( -DKDEPIM_NO_KRESOURCES )
226   endif()
229 ############### Now, we add the PIM components ###############
231   include (kleopatra/ConfigureChecks.cmake)
233   # These targets will always be built before anything else.
235   add_subdirectory(noteshared)
236   add_subdirectory(akonadi_next)
237   add_subdirectory(libkdepim)
238   add_subdirectory(calendarsupport)
239   add_subdirectory(calendarviews)
240   add_subdirectory(incidenceeditor-ng)
241   add_subdirectory(libkdepimdbusinterfaces)
242   add_subdirectory(libkleo)
243   add_subdirectory(libkpgp)
244   add_subdirectory(libksieve)
245   add_subdirectory(kdgantt2)
246   add_subdirectory(icons)
247   add_subdirectory(composereditor-ng)
248   add_subdirectory(messagecore)
249   add_subdirectory(grantleetheme)
250   add_subdirectory(messagelist)
251   add_subdirectory(templateparser)
253   if(QGPGME_FOUND)
254     if(Boost_TOPOLOGICAL_SORT_DIR)
255       macro_optional_add_subdirectory(kleopatra)
256     endif()
257   endif()
259   # The following components depend on QGpgME.
260   add_subdirectory(messageviewer)
261   macro_optional_add_subdirectory(messagecomposer)
262   add_subdirectory(pimcommon)
263   add_subdirectory(mailcommon) # TODO: does this make sense?!?
264   macro_optional_add_subdirectory(kmail)
265   macro_optional_add_subdirectory(grantleeeditor)
266   if(KDEPIM_BUILD_MOBILE)
267     add_subdirectory(mobile)
268   endif()
270   if(KDEPIM_BUILD_EXAMPLES)
271     add_subdirectory(examples)
272   endif()
274   # If kmail is compiled, KMAIL_SUPPORTED is true (used in several places)
275   if(BUILD_kmail)
276     set(KMAIL_SUPPORTED TRUE)
277     add_definitions(-DKMAIL_SUPPORTED)
278   endif()
280   macro_optional_add_subdirectory(korganizer)
281   macro_optional_add_subdirectory(korgac)
282   macro_optional_add_subdirectory(sieveeditor)
283   macro_optional_add_subdirectory(storageservicemanager)
284   add_subdirectory(kaddressbookgrantlee)
285   if(KDEPIM_BUILD_DESKTOP)
286     macro_optional_add_subdirectory(agents)
287     macro_optional_add_subdirectory(akregator)
288     macro_optional_add_subdirectory(importwizard)
289     macro_optional_add_subdirectory(kaddressbook)
290     macro_optional_add_subdirectory(kmailcvt)
291     macro_optional_add_subdirectory(mboximporter)
292     macro_optional_add_subdirectory(knotes)
293     macro_optional_add_subdirectory(ksendemail)
294     macro_optional_add_subdirectory(ktnef)
295     macro_optional_add_subdirectory(mailimporter)
296     macro_optional_add_subdirectory(pimsettingexporter)
297     macro_optional_add_subdirectory(kalarm)
299     if(KDEPIMLIBS_KCAL_LIBRARY)
300       macro_optional_add_subdirectory(blogilo)
301     endif()
303     macro_optional_add_subdirectory(kjots)
305     if(KDEPIMLIBS_KRESOURCES_LIBRARY)
306       if(QT_QT3SUPPORT_FOUND)
307         macro_optional_add_subdirectory(knode)
308       endif()
310       if(Q_WS_X11)
311         macro_optional_add_subdirectory(ktimetracker)
312       endif()
314     endif()
315     macro_optional_add_subdirectory(kontact) # must be the last one.
316   endif()
318   macro_optional_add_subdirectory(akonadiconsole)
319   macro_optional_add_subdirectory(console)
321   # These targets depend on optional applications
322   if(KDEPIMLIBS_KRESOURCES_LIBRARY)
323     add_subdirectory(kresources) # Must be after KAddressbook
324   endif()
326   add_subdirectory(plugins) # Must be after KMail
328 endif()
330 # doc must be a subdir of kdepim or packagers will kill us
331 macro_optional_add_subdirectory(doc)
333 # All done, let's display what we found...
334 feature_summary(WHAT ALL
335                      INCLUDE_QUIET_PACKAGES
336                      FATAL_ON_MISSING_REQUIRED_PACKAGES
337                )