french -> French
[kdepim.git] / CMakeLists.txt
blob51e83c8bac14673e3a0e74d882b818eaa04d1678
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( -DDISABLE_NEPOMUK_LEGACY )
24 add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
25 if(KDEPIM_NO_WEBKIT)
26   add_definitions(-DKDEPIM_NO_WEBKIT)
27 endif()
29 # cmake would not find kde for xcompile if that is not set
30 if(WINCE)
31     set(KDE4_DATA_DIR "${CMAKE_PREFIX_PATH}/share/apps")
32     set(LIBRARY_TYPE STATIC)
33     add_definitions(-DKDELIBS_STATIC_LIBS)
34     add_definitions(-DKDEPIM_STATIC_LIBS)
35 endif()
37 if(KDEPIM_ENTERPRISE_BUILD)
38   message(STATUS "Enterprise build is enabled.")
39 endif()
41 # if KDEPIM_ONLY_KLEO is defined, KDEPIM_BUILD_MOBILE and KDEPIM_MOBILE_UI are disabled.
42 if(KDEPIM_ONLY_KLEO)
43  set(KDEPIM_BUILD_MOBILE FALSE)
44  set(KDEPIM_MOBILE_UI FALSE)
45  set(KDEPIM_DEFINITIONS "-DHAVE_CONFIG_H=1")
46  message(STATUS "Only libkleo and Kleopatra will be built.")
47 endif()
49 if(KDEPIM_MOBILE_UI)
50     # Build the mobile applications
51     set(KDEPIM_BUILD_MOBILE TRUE)
52 endif()
54 # config-enterprise.h is needed for both ENTERPRISE_BUILD and BUILD_EVERYTHING
55 configure_file(config-enterprise.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-enterprise.h )
57 ############### generate kdepim-version.h ###############
58 # Support for the GIT revision number in kdepim-version.h
59 if(EXISTS "${kdepim_SOURCE_DIR}/.git")
60   find_package(Git)
61   if(GIT_FOUND)
62     message(STATUS "Found git: ${GIT_EXECUTABLE}")
63     execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
64                     WORKING_DIRECTORY ${kdepim_SOURCE_DIR}
65                     OUTPUT_VARIABLE kdepim_git_revision)
66     string(REGEX REPLACE "\n" "" kdepim_git_revision "${kdepim_git_revision}")
67     set(kdepim_git_revision "git-${kdepim_git_revision}")
69     execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --oneline --format=%ci
70                     WORKING_DIRECTORY ${kdepim_SOURCE_DIR}
71                     OUTPUT_VARIABLE kdepim_git_last_change)
72     string(REGEX REPLACE " [-0-9:+ ]*\n" "" kdepim_git_last_change "${kdepim_git_last_change}")
73   endif()
74 endif()
76 # KDEPIM_VERSION
77 # Version scheme: "x.y.z build".
79 # x is the version number.
80 # y is the major release number.
81 # z is the minor release number.
83 # "x.y.z" follow the kdelibs version kdepim is released with.
85 # If "z" is 0, the version is "x.y"
87 # KDEPIM_DEV_VERSION is empty for final versions.
88 # For development versions "build" is something like "pre", "alpha1", "alpha2", "beta1", "beta2", "rc1", "rc2".
90 # Examples in chronological order:
91 # 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
93 # Do NOT add quote
94 set(KDEPIM_DEV_VERSION pre)
96 # add an extra space
97 if(DEFINED KDEPIM_DEV_VERSION)
98   set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}")
99 endif()
101 set(KDEPIM_VERSION "4.13${KDEPIM_DEV_VERSION}")
103 configure_file(kdepim-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdepim-version.h @ONLY)
105 set(CMAKE_AUTOMOC ON)
107 ############### search packages used by KDE ###############
109 # It is needed otherwise it finds the kde4-config of the target platform
110 if(WINCE)
111   find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config PATHS ${HOST_BINDIR} NO_DEFAULT_PATH)
112 endif()
114 find_package(KDE4 4.11.3 REQUIRED)
115 include(KDE4Defaults)
117 find_package(KdepimLibs 4.12.42)
118 set_package_properties(KdepimLibs PROPERTIES DESCRIPTION "The KDEPIM libraries" URL "http://www.kde.org" TYPE REQUIRED)
120 ############### Load the CTest options ###############
122 # CMake is irritating and doesn't allow setting the tests timeout globally.
123 # Let's work around this. The global timeout is now 2 minutes.
124 set(_DartConfigFile "${CMAKE_BINARY_DIR}/DartConfiguration.tcl")
125 if(EXISTS ${_DartConfigFile})
126   set(DartTestingTimeout "120")
127   file(READ ${_DartConfigFile} _DartConfigFile_content)
128   string(REGEX REPLACE "TimeOut: 1500" "TimeOut: ${DartTestingTimeout}" _DartConfigFile_content ${_DartConfigFile_content})
129   file(WRITE ${_DartConfigFile} ${_DartConfigFile_content})
130 endif()
132 # CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
133 # in the KDE build system, this is the same as CMAKE_BINARY_DIR.
134 configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
136 ############### search Boost ###############
138 find_package(Boost 1.34.0)
139 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")
141 # Kleopatra needs to know if the topological.hpp header exists (part of Boost_graph).
142 find_path(Boost_TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
143 if(Boost_TOPOLOGICAL_SORT_DIR)
144   message(STATUS "The Boost Topological_sort header was found. Building Kleopatra")
145 else()
146   message(STATUS "The Boost Topological_sort header was NOT found. Kleopatra will not be built")
147 endif()
149 ############### Windows specific ###############
151 if(WIN32)
152   # detect oxygen icon dir at configure time based on KDEDIRS - there may be different package installation locations
153   execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
154   file(TO_CMAKE_PATH "${_dir}" __dir)
155   find_path(KDE4_ICON_DIR oxygen PATHS
156     ${__dir}
157   )
158   message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")
159 else()
160     set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
161 endif()
163 ############### ONLY_KLEO ###############
165 # If the KDEPIM_ONLY_KLEO option is true
166 if(KDEPIM_ONLY_KLEO)
167   find_package(QGpgme)
168   set_package_properties(QGpgme PROPERTIES DESCRIPTION "The QGpgME library" URL "http://www.kde.org" TYPE REQUIRED PURPOSE "QGpgME is required to build Kleopatra.")
170   add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS})
171   include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIRS} ${QT_QTDBUS_INCLUDE_DIR})
172   include(kleopatra/ConfigureChecks.cmake)
174   add_subdirectory(libkleo)
175   if(Boost_TOPOLOGICAL_SORT_DIR)
176     add_subdirectory(kleopatra)
177   endif()
178 else()
180 # Otherwise...
181 ############### Find the stuff we need ###############
182   # Akonadi
183   find_package(Akonadi 1.10.45 QUIET CONFIG)
184   set_package_properties(Akonadi PROPERTIES DESCRIPTION "Akonadi server libraries" URL "http://pim.kde.org/akonadi" TYPE REQUIRED PURPOSE "Akonadi is required to build KDEPIM")
186   find_package(ZLIB)
187   set_package_properties(ZLIB PROPERTIES DESCRIPTION "The Zlib compression library" URL "http://www.zlib.net" TYPE REQUIRED)
189   find_package(QGpgme)
190   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")
192   find_package(SharedDesktopOntologies 0.11)
193   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")
195   find_package(Soprano 2.9.0)
196   set_package_properties(Soprano PROPERTIES DESCRIPTION "C++/Qt4 framework for RDF data" URL "http://soprano.sourceforge.net" TYPE REQUIRED PURPOSE "Storage of semantic data")
197   include(SopranoAddOntology)
199   find_package(Grantlee 0.3.0 QUIET CONFIG)
200   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)." )
202   find_package(NepomukCore QUIET CONFIG)
203   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")
205   find_package(NepomukWidgets QUIET CONFIG)
206   set_package_properties(NepomukWidgets PROPERTIES DESCRIPTION "The NepomukWidget libraries" URL "http://www.kde.org" TYPE RECOMMENDED PURPOSE "Nepomuk-widgets is needed for building Akonadiconsole")
208   # Xsltproc
209   find_package(Xsltproc)
210   set_package_properties(Xsltproc PROPERTIES DESCRIPTION "XSLT processor from libxslt" TYPE REQUIRED PURPOSE "Required to generate D-Bus interfaces.")
212   find_package(QJSON)
213   set_package_properties(QJSON PROPERTIES DESCRIPTION "QJSON" URL "http://qjson.sourceforge.net/" TYPE REQUIRED PURPOSE "Qt library for handling JSON data")
215   find_package(Prison QUIET CONFIG)
216   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")
219 ############### Desktop vs. Mobile options ##############
221   if(KDEPIM_MOBILE_UI)
222     add_definitions( -DKDEPIM_MOBILE_UI )
223     if(NOT QT_QTDECLARATIVE_FOUND)
224       message(FATAL_ERROR "The QtDeclarative (QML) module is required for building the mobile UI")
225     endif()
226   else()
227     if(NOT QT_QTDECLARATIVE_FOUND)
228       message(STATUS "The Qt Declarative (QML) module was not found. The mobile applications will not be built.")
229       set(KDEPIM_BUILD_MOBILE FALSE)
230     endif()
231   endif()
233 ############### Needed commands before building anything ###############
235   add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS} ${AKONADI_DEFINITIONS})
237   include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
239   if(NOT KDEPIMLIBS_KRESOURCES_LIBRARY)
240     add_definitions( -DKDEPIM_NO_KRESOURCES )
241   endif()
244 ############### Now, we add the PIM components ###############
246   include (kleopatra/ConfigureChecks.cmake)
248   # These targets will always be built before anything else.
250   add_subdirectory(ontologies) # must be the first one.
251   add_subdirectory(noteshared)
252   add_subdirectory(akonadi_next)
253   add_subdirectory(libkdepim)
254   add_subdirectory(calendarsupport)
255   add_subdirectory(calendarviews)
256   add_subdirectory(incidenceeditor-ng)
257   add_subdirectory(libkdepimdbusinterfaces)
258   add_subdirectory(libkleo)
259   add_subdirectory(libkpgp)
260   add_subdirectory(libksieve)
261   add_subdirectory(kdgantt2)
262   add_subdirectory(icons)
263   add_subdirectory(composereditor-ng)
264   add_subdirectory(grammar)
265   add_subdirectory(messagecore)
266   add_subdirectory(grantleetheme)
267   if(NOT WINCE)
268     add_subdirectory(messagelist)
269   else()
270     # We need to compile runtime in kdepim because of the static
271     # linking of korgac and the applications need to link against
272     # plugins like the serializer plugins. If the korgac would
273     # move to runtime this can be avoided
274     add_subdirectory(runtime)
275   endif()
276   add_subdirectory(templateparser)
278   if(QGPGME_FOUND)
279     if(Boost_TOPOLOGICAL_SORT_DIR)
280       macro_optional_add_subdirectory(kleopatra)
281     endif()
282   endif()
284   # The following components depend on QGpgME.
285   add_subdirectory(messageviewer)
286   macro_optional_add_subdirectory(messagecomposer)
287   add_subdirectory(pimcommon)
288   add_subdirectory(mailcommon) # TODO: does this make sense?!?
289   macro_optional_add_subdirectory(kmail)
290   macro_optional_add_subdirectory(headerthemeeditor)
291   macro_optional_add_subdirectory(contactthemeeditor)
292   add_subdirectory(grantleethemeeditor)
294   if(KDEPIM_BUILD_MOBILE)
295     add_subdirectory(mobile)
296   endif()
298   if(KDEPIM_BUILD_EXAMPLES)
299     add_subdirectory(examples)
300   endif()
302   # If kmail is compiled, KMAIL_SUPPORTED is true (used in several places)
303   if(BUILD_kmail)
304     set(KMAIL_SUPPORTED TRUE)
305     add_definitions(-DKMAIL_SUPPORTED)
306   endif()
308   macro_optional_add_subdirectory(pimactivity)
309   macro_optional_add_subdirectory(korganizer)
310   macro_optional_add_subdirectory(korgac)
311   add_subdirectory(kaddressbookgrantlee)
312   if(KDEPIM_BUILD_DESKTOP)
313     macro_optional_add_subdirectory(agents)
314     macro_optional_add_subdirectory(akregator)
315     macro_optional_add_subdirectory(importwizard)
316     macro_optional_add_subdirectory(kaddressbook)
317     macro_optional_add_subdirectory(kmailcvt)
318     macro_optional_add_subdirectory(mboximporter)
319     macro_optional_add_subdirectory(knotes)
320     macro_optional_add_subdirectory(ksendemail)
321     macro_optional_add_subdirectory(ktnef)
322     macro_optional_add_subdirectory(mailimporter)
323     macro_optional_add_subdirectory(pimsettingexporter)
324     macro_optional_add_subdirectory(kalarm)
326     if(KDEPIMLIBS_KCAL_LIBRARY)
327       macro_optional_add_subdirectory(blogilo)
328     endif()
330     macro_optional_add_subdirectory(kjots)
332     if(KDEPIMLIBS_KRESOURCES_LIBRARY)
333       if(QT_QT3SUPPORT_FOUND)
334         macro_optional_add_subdirectory(knode)
335       endif()
337       if(Q_WS_X11)
338         macro_optional_add_subdirectory(ktimetracker)
339       endif()
341     endif()
342     macro_optional_add_subdirectory(kontact) # must be the last one.
343   endif()
345   if(NepomukWidgets_FOUND)
346     macro_optional_add_subdirectory(akonadiconsole)
347   endif()
348   macro_optional_add_subdirectory(console)
349   if(Strigi_FOUND)
350     macro_optional_add_subdirectory(strigi-analyzer)
351   endif()
353   # These targets depend on optional applications
354   if(KDEPIMLIBS_KRESOURCES_LIBRARY)
355     add_subdirectory(kresources) # Must be after KAddressbook
356   endif()
358   add_subdirectory(plugins) # Must be after KMail
360 endif()
362 # doc must be a subdir of kdepim or packagers will kill us
363 macro_optional_add_subdirectory(doc)
365 # All done, let's display what we found...
366 feature_summary(WHAT ALL
367                      INCLUDE_QUIET_PACKAGES
368                      FATAL_ON_MISSING_REQUIRED_PACKAGES
369                )