The last part of typo fixes (I really hope)
[kdepim.git] / CMakeLists.txt
blobed55e08269b25b29c0383fc6ca7832bc188c6baf
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_SOURCE_DIR}/cmake/modules")
7 ############### Build Options ###############
9 option(KDEPIM_BUILD_EXAMPLES "Build the kdepim example applications." FALSE)
10 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)
11 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)
12 option(KDEPIM_MOBILE_UI "Build UI for mobile devices instead of for desktops" FALSE)
13 option(KDEPIM_ONLY_KLEO "Only build Kleopatra. This option will disable KDEPIM_BUILD_EVERYTHING and KDEPIM_ENTERPRISE_BUILD." FALSE)
14 option(KDEPIM_BUILD_STATIC "Build KDEPIM static." FALSE)
15 option(KDEPIM_BUILD_DESKTOP "Build Desktop Applications. Can be deactivated for mobile" TRUE)
16 option(KDEPIM_NO_NEPOMUK "Build the mail libraries and applications without nepomuk dependency" FALSE)
17 option(KDEPIM_NO_WEBKIT "Do not use WebKit in the kdepim applications" FALSE)
19 if(KDEPIM_BUILD_STATIC)
20   set(LIBRARY_TYPE STATIC)
21 else(KDEPIM_BUILD_STATIC)
22   set(LIBRARY_TYPE SHARED)
23 endif(KDEPIM_BUILD_STATIC)
25 add_definitions( -DDISABLE_NEPOMUK_LEGACY )
26 add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
28 if(KDEPIM_NO_NEPOMUK)
29   add_definitions(-DKDEPIM_NO_NEPOMUK)
30 endif(KDEPIM_NO_NEPOMUK)
32 if(KDEPIM_NO_WEBKIT)
33   add_definitions(-DKDEPIM_NO_WEBKIT)
34 endif()
36 # cmake would not find kde for xcompile if that is not set
37 if(WINCE)
38     set(KDE4_DATA_DIR "${CMAKE_PREFIX_PATH}/share/apps")
39     set(LIBRARY_TYPE STATIC)
40     add_definitions(-DKDELIBS_STATIC_LIBS)
41     add_definitions(-DKDEPIM_STATIC_LIBS)
42 endif(WINCE)
45 # Default
46 set(KDEPIM_BUILD_EVERYTHING TRUE)
48 # if KDEPIM_ENTERPRISE_BUILD is defined, KDEPIM_ONLY_KLEO is disabled
49 # FIXME build the mobile applications ?
50 if(KDEPIM_ENTERPRISE_BUILD)
51   set(KDEPIM_ONLY_KLEO FALSE)
52   set(KDEPIM_BUILD_EVERYTHING FALSE)
53   message(STATUS "Enterprise build is enabled.")
54 else()
55   # if KDEPIM_ONLY_KLEO is defined, KDEPIM_BUILD_EVERYTHING, KDEPIM_BUILD_MOBILE and KDEPIM_MOBILE_UI are disabled.
56   if(KDEPIM_ONLY_KLEO)
57     set(KDEPIM_BUILD_EVERYTHING FALSE)
58     set(KDEPIM_BUILD_MOBILE FALSE)
59     set(KDEPIM_MOBILE_UI FALSE)
60     set(KDEPIM_DEFINITIONS "-DHAVE_CONFIG_H=1")
61     message(STATUS "Only libkleo and Kleopatra will be built.")
62   endif()
63 endif()
65 if(KDEPIM_MOBILE_UI)
66     # Build the mobile applications
67     set(KDEPIM_BUILD_MOBILE TRUE)
68 endif()
70 # config-enterprise.h is needed for both ENTERPRISE_BUILD and BUILD_EVERYTHING
71 configure_file(config-enterprise.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-enterprise.h )
73 ############### generate kdepim-version.h ###############
74 # Support for the GIT revision number in kdepim-version.h
75 if(EXISTS "${kdepim_SOURCE_DIR}/.git")
76   find_package(Git)
77   if(GIT_FOUND)
78     execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
79                     WORKING_DIRECTORY ${kdepim_SOURCE_DIR}
80                     OUTPUT_VARIABLE kdepim_git_revision)
81     string(REGEX REPLACE "\n" "" kdepim_git_revision "${kdepim_git_revision}")
82     set(kdepim_git_revision "git-${kdepim_git_revision}")
84     execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --oneline --format=%ci
85                     WORKING_DIRECTORY ${kdepim_SOURCE_DIR}
86                     OUTPUT_VARIABLE kdepim_git_last_change)
87     string(REGEX REPLACE " [-0-9:+ ]*\n" "" kdepim_git_last_change "${kdepim_git_last_change}")
88   endif()
89 endif()
91 # KDEPIM_VERSION 
92 # Version scheme: "x.y.z build".
94 # x is the version number.
95 # y is the major release number.
96 # z is the minor release number.
98 # "x.y.z" follow the kdelibs version kdepim is released with.
100 # If "z" is 0, it the version is "x.y"
102 # KDEPIM_DEV_VERSION
103 # is empty for final versions. For development versions "build" is
104 # something like "pre", "alpha1", "alpha2", "beta1", "beta2", "rc1", "rc2".
106 # Examples in chronological order:
108 #    3.0
109 #    3.0.1
110 #    3.1 alpha1
111 #    3.1 beta1
112 #    3.1 beta2
113 #    3.1 rc1
114 #    3.1
115 #    3.1.1
116 #    3.2 pre
117 #    3.2 alpha1
119 if (NOT DEFINED KDEPIM_DEV_VERSION)
120     set( KDEPIM_DEV_VERSION "pre" )
121 endif (NOT DEFINED KDEPIM_DEV_VERSION)
123 set( KDEPIM_VERSION "4.8 ${KDEPIM_DEV_VERSION}" )
124 configure_file(kdepim-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdepim-version.h @ONLY)
126 ############### search packages used by KDE ###############
128 # It is needed otherwise it finds the kde4-config of the target platform
129 if(WINCE)
130 find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config PATHS ${HOST_BINDIR} NO_DEFAULT_PATH)
131 endif(WINCE)
133 find_package(KDE4 4.6.2 REQUIRED)
134 include(KDE4Defaults)
135 include(MacroLibrary)
136 include(CheckIncludeFiles)
137 include(MacroBoolTo01)
138 find_package(KdepimLibs 4.6.41 REQUIRED)
140 ############### Load the CTest options ###############
142 # CMake is irritating and doesn't allow setting the tests timeout globally.
143 # Let's work around this. The global timeout is now 2 minutes.
144 set(_DartConfigFile "${CMAKE_BINARY_DIR}/DartConfiguration.tcl")
145 if(EXISTS ${_DartConfigFile})
146   set(DartTestingTimeout "120")
147   file(READ ${_DartConfigFile} _DartConfigFile_content)
148   string(REGEX REPLACE "TimeOut: 1500" "TimeOut: ${DartTestingTimeout}" _DartConfigFile_content ${_DartConfigFile_content})
149   file(WRITE ${_DartConfigFile} ${_DartConfigFile_content})
150 endif()
152 # CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
153 # in the KDE build system, this is the same as CMAKE_BINARY_DIR.
154 configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
157 ############### search Boost ###############
159 find_package(Boost 1.34.0)
160 macro_log_feature(Boost_FOUND "Boost" "Boost C++ Libraries" "http://www.boost.org" TRUE "1.34.0" "Required by several critical KDEPIM apps.")
162 # Kleopatra needs to know if the topological.hpp header exists (part of Boost_graph).
163 find_path(Boost_TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
164 macro_log_feature(Boost_TOPOLOGICAL_SORT_DIR "The Boost Topological_sort header" "topological_sort.hpp (part of Boost_graph)" "http://www.boost.org/" FALSE "" "Necessary to build kleopatra")
167 ############### Windows specific ###############
169 if(WIN32)
170   # detect oxygen icon dir at configure time based on KDEDIRS - there may be different package installation locations
171   execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
172   file(TO_CMAKE_PATH "${_dir}" __dir)
173   find_path(KDE4_ICON_DIR oxygen PATHS
174     ${__dir}
175   )
176   message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")
177 else(WIN32)
178     set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
179 endif(WIN32)
182 ############### ONLY_KLEO ###############
184 # The KDEPIM_ONLY_KLEO option is true
185 if(KDEPIM_ONLY_KLEO)
186   find_package(QGpgme)
187   macro_log_feature(QGPGME_FOUND "QGpgME" "The QGpgME library" "http://www.kde.org" TRUE "" "QGpgME is required to build Kleopatra.")
189   add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS} -DQT3_SUPPORT_WARNINGS)
190   include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIRS} ${QT_QTDBUS_INCLUDE_DIR})
191   include(kleopatra/ConfigureChecks.cmake)
193   add_subdirectory(libkleo)
194   if (Boost_TOPOLOGICAL_SORT_DIR)
195     macro_optional_add_subdirectory(kleopatra)
196   endif (Boost_TOPOLOGICAL_SORT_DIR)
198 else(KDEPIM_ONLY_KLEO)
200 # Otherwise...
201 ############### Find the stuff we need ###############
202   set(AKONADI_MIN_VERSION 1.4.91)
203   find_package(Akonadi QUIET NO_MODULE ${AKONADI_MIN_VERSION})
204   macro_log_feature(Akonadi_FOUND "Akonadi" "Akonadi server libraries" "http://pim.kde.org/akonadi" TRUE "${AKONADI_MIN_VERSION}" "Akonadi is required to build KDEPIM")
206   find_package(ZLIB)
207   macro_log_feature(ZLIB_FOUND "ZLib" "The Zlib compression library" "http://www.zlib.net" TRUE "" "")
209   find_package(Strigi)
210   macro_log_feature(STRIGI_FOUND "Strigi" "Index metadata of files" "http://strigi.sourceforge.net" TRUE "" "")
212   find_package(QGpgme)
213   macro_log_feature(QGPGME_FOUND "QGpgME" "The QGpgME library" "http://www.kde.org" FALSE "" "QGpgME is required to build KMail, KOrganizer and Kleopatra")
215   set(SDO_MIN_VERSION 0.6.51)
216   set(SOPRANO_MIN_VERSION 2.3.70)
218   find_package(SharedDesktopOntologies ${SDO_MIN_VERSION})
219   macro_log_feature(SHAREDDESKTOPONTOLOGIES_FOUND "Shared desktop ontologies" "Desktop ontologies" "http://oscaf.sourceforge.net" TRUE "${SDO_MIN_VERSION}" "Ontologies necessary for the Nepomuk semantic desktop.")
221   find_package(Soprano)
222   macro_log_feature(Soprano_FOUND "Soprano" "Semantic Desktop Storing" "http://soprano.sourceforge.net" TRUE "${SOPRANO_MIN_VERSION}" "Soprano is needed for Nepomuk")
223   include(SopranoAddOntology)
225   find_package(Grantlee QUIET NO_MODULE)
226   macro_log_feature(Grantlee_FOUND "Grantlee" "The Grantlee Template System" "http://www.grantlee.org" FALSE "" "Templating and theming for KJots and KaddressBook." )
228 if(NOT KDEPIM_NO_NEPOMUK)
229   find_package(Nepomuk)
230   macro_log_feature(Nepomuk_FOUND "Nepomuk" "The Nepomuk libraries" "http://www.kde.org" TRUE "" "Nepomuk extends the search and tagging functionalities in KMail and Akonadi")
231 endif(NOT KDEPIM_NO_NEPOMUK)
232   
233   find_package(LibXslt)
234   macro_log_feature(XSLTPROC_EXECUTABLE "xsltproc" "The command line XSLT processor from libxslt" "http://xmlsoft.org/XSLT/" TRUE "" "Required to generate the D-Bus interfaces.")
236 ############### Desktop vs. Mobile options ##############
238 if (KDEPIM_MOBILE_UI)
239   macro_log_feature(QT_QTDECLARATIVE_FOUND "QtDeclarative" "Qt Declarative (QML) module" "http://qt.nokia.com" TRUE "4.7" "Required for building mobile UI")
240   add_definitions( -DKDEPIM_MOBILE_UI )
241 else()
242   macro_log_feature(QT_QTDECLARATIVE_FOUND "QtDeclarative" "Qt Declarative (QML) module" "http://qt.nokia.com" FALSE "4.7" "Required for building the mobile applications")
243   if (NOT QT_QTDECLARATIVE_FOUND)
244     message(STATUS "The Qt Declarative (QML) module was not found. The mobile applications will not be built.")
245     set(KDEPIM_BUILD_MOBILE FALSE)
246   endif()
247 endif()
249 ############### Needed commands before building anything ###############
251 add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS} ${AKONADI_DEFINITIONS})
253 include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/libkdepim  ${Boost_INCLUDE_DIR})
255 if (NOT KDEPIMLIBS_KRESOURCES_LIBRARY)
256   add_definitions( -DKDEPIM_NO_KRESOURCES )
257 endif (NOT KDEPIMLIBS_KRESOURCES_LIBRARY)
259 ############### Macros ###############
261 # generates a D-Bus interface description from a KConfigXT file
262 macro(kcfg_generate_dbus_interface _kcfg _name)
263   add_custom_command(
264     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_name}.xml
265     COMMAND ${XSLTPROC_EXECUTABLE} --stringparam interfaceName ${_name}
266     ${KDEPIMLIBS_DATA_DIR}/akonadi-kde/kcfg2dbus.xsl
267     ${_kcfg}
268     > ${CMAKE_CURRENT_BINARY_DIR}/${_name}.xml
269     DEPENDS ${KDEPIMLIBS_DATA_DIR}/akonadi-kde/kcfg2dbus.xsl
270     ${_kcfg}
271     )
272 endmacro(kcfg_generate_dbus_interface)
275 ############### Code used in several places ###############
276 # TODO Remove from the top CMakeLists.
278 # used in knotes, kontact/plugins/knotes, kresources/egroupware, kresources/kolab/knotes, kresources/scalix/knotes, wizard
279 set(libknotesresources_SRCS
280   ${CMAKE_SOURCE_DIR}/knotes/resourcemanager.cpp
281   ${CMAKE_SOURCE_DIR}/knotes/resourcenotes.cpp
282   ${CMAKE_SOURCE_DIR}/knotes/resourcelocal.cpp
283   ${CMAKE_SOURCE_DIR}/knotes/resourcelocalconfig.cpp
286 # used in knotes, kontact/plugins/knotes
287 set(libknoteseditor_SRCS
288   ${CMAKE_SOURCE_DIR}/knotes/knoteedit.cpp
291 ############### Now, we add the PIM components ###############
293   include (kleopatra/ConfigureChecks.cmake)
295   # These targets will always be built before anything else.
297   add_subdirectory(ontologies) # must be the first one.
298   add_subdirectory(akonadi_next)
299   add_subdirectory(libkdepim)
300   add_subdirectory(calendarsupport)
301   add_subdirectory(calendarviews)
302   add_subdirectory(incidenceeditor-ng)
303   add_subdirectory(libkdepimdbusinterfaces)
304   add_subdirectory(libkleo)
305   add_subdirectory(libkpgp)
306   add_subdirectory(libksieve)
307   add_subdirectory(kdgantt2)
308   add_subdirectory(icons)
309   add_subdirectory(messagecore)
310 if (NOT WINCE)
311   add_subdirectory(messagelist)
312 else (NOT WINCE)
313   # We need to compile runtime in kdepim because of the static
314   # linking of korgac and the applications need to link against
315   # plugins like the serializer plugins. If the korgac would
316   # move to runtime this can be avoided
317   add_subdirectory(runtime)
318 endif (NOT WINCE)
319   add_subdirectory(templateparser)
321   if(QGPGME_FOUND)
322     if (Boost_TOPOLOGICAL_SORT_DIR)
323       macro_optional_add_subdirectory(kleopatra)
324     endif(Boost_TOPOLOGICAL_SORT_DIR)
325     if (QT_QT3SUPPORT_FOUND AND KDEPIMLIBS_KRESOURCES_LIBRARY)
326       macro_optional_add_subdirectory(wizards)
327     endif (QT_QT3SUPPORT_FOUND AND KDEPIMLIBS_KRESOURCES_LIBRARY)
328     # The following components depend on QGpgME.
329     set(MESSAGEVIEWER_SUPPORTED TRUE)
330     add_subdirectory(messageviewer)
331     macro_optional_add_subdirectory(messagecomposer)
332     add_subdirectory(mailcommon)
333     macro_optional_add_subdirectory(kmail)
334     if (KDEPIM_BUILD_MOBILE)
335       add_subdirectory(mobile)
336     endif (KDEPIM_BUILD_MOBILE)
338     if(KDEPIM_BUILD_EXAMPLES)
339       add_subdirectory(examples)
340     endif(KDEPIM_BUILD_EXAMPLES)
342     # If kmail is compiled, KMAIL_SUPPORTED is true (used in several places)
343     if(BUILD_kmail)
344       set(KMAIL_SUPPORTED TRUE)
345       add_definitions(-DKMAIL_SUPPORTED)
346     endif(BUILD_kmail)
348     if (KDEPIM_BUILD_DESKTOP)
349       macro_optional_add_subdirectory(kmailcvt)
350       macro_optional_add_subdirectory(ksendemail)
351     endif (KDEPIM_BUILD_DESKTOP)
353     macro_optional_add_subdirectory(korganizer)
355     # disabled until Strigi dep is removed
356     if (NOT WINCE AND NOT KDEPIM_NO_NEPOMUK)
357       if (SHAREDDESKTOPONTOLOGIES_VERSION VERSION_GREATER 0.3.59)
358         add_subdirectory( nepomuk_email_feeder )
359       endif (SHAREDDESKTOPONTOLOGIES_VERSION VERSION_GREATER 0.3.59)
360     endif()
361   endif(QGPGME_FOUND)
363   if(KDEPIM_BUILD_EVERYTHING AND QT_QT3SUPPORT_FOUND AND KDEPIMLIBS_KRESOURCES_LIBRARY AND KDEPIM_BUILD_DESKTOP)
364     macro_optional_add_subdirectory(knode)
365   endif(KDEPIM_BUILD_EVERYTHING AND QT_QT3SUPPORT_FOUND AND KDEPIMLIBS_KRESOURCES_LIBRARY AND KDEPIM_BUILD_DESKTOP)
367   if (KDEPIM_BUILD_DESKTOP)
368     macro_optional_add_subdirectory(akregator)
369   endif (KDEPIM_BUILD_DESKTOP)
370   macro_optional_add_subdirectory(akonadiconsole)
371   if (KDEPIMLIBS_KCAL_LIBRARY AND KDEPIM_BUILD_DESKTOP)
372     macro_optional_add_subdirectory(blogilo)
373   endif (KDEPIMLIBS_KCAL_LIBRARY AND KDEPIM_BUILD_DESKTOP)
374   macro_optional_add_subdirectory(console)
376   if (Grantlee_FOUND AND KDEPIM_BUILD_DESKTOP)
377     macro_optional_add_subdirectory(kjots)
378   endif (Grantlee_FOUND AND KDEPIM_BUILD_DESKTOP)
379   if (KDEPIMLIBS_KRESOURCES_LIBRARY)
380     macro_optional_add_subdirectory(knotes)
381   endif (KDEPIMLIBS_KRESOURCES_LIBRARY)
382   macro_optional_add_subdirectory(strigi-analyzer)
384   if (KDEPIMLIBS_KRESOURCES_LIBRARY AND NOT MINGW AND KDEPIM_BUILD_DESKTOP)
385     macro_optional_add_subdirectory(kalarm)
386   endif (KDEPIMLIBS_KRESOURCES_LIBRARY AND NOT MINGW AND KDEPIM_BUILD_DESKTOP)
388   if (KDEPIM_BUILD_DESKTOP)
389     macro_optional_add_subdirectory(kaddressbook)
390   endif (KDEPIM_BUILD_DESKTOP)
391   if(Q_WS_X11 AND KDEPIMLIBS_KRESOURCES_LIBRARY AND KDEPIM_BUILD_DESKTOP)
392     macro_optional_add_subdirectory(ktimetracker)
393   endif(Q_WS_X11 AND KDEPIMLIBS_KRESOURCES_LIBRARY AND KDEPIM_BUILD_DESKTOP)
395   if (KDEPIM_BUILD_DESKTOP)
396     macro_optional_add_subdirectory(kontact) # must be the last one.
397   endif (KDEPIM_BUILD_DESKTOP)
399   # These targets depend on optional applications
400   if (KDEPIMLIBS_KRESOURCES_LIBRARY)
401     add_subdirectory(kresources) # Must be after KAddressbook
402   endif (KDEPIMLIBS_KRESOURCES_LIBRARY)
403   add_subdirectory(plugins) # Must be after KMail
405 endif (KDEPIM_ONLY_KLEO)
407 # doc must be a subdir of kdepim or packagers will kill us
408 macro_optional_add_subdirectory(doc)
411 # We really want to encourage users to enable/install QGpgME from kdepimlibs
412 if(NOT QGPGME_FOUND)
413   # Users must be aware that QGpgMe is really needed
414   message(STATUS "*** WARNING: QGpgME is not installed on your system ***")
415   message(STATUS "*** It is required if you want to use KMail, KOrganizer or Kleopatra ***")
416   message(STATUS "*** You are really encouraged to install it ***")
417 endif(NOT QGPGME_FOUND)
418 # All done, let's display what we found...
419 macro_display_feature_log()