Make me trust this output by using the original enums.
[kdepim.git] / CMakeLists.txt
blobaae2aa1e7df459090218dbeee6b14dd55b14b28d
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 # Do NOT add quote
120 set(KDEPIM_DEV_VERSION pre)
122 # add an extra space
123 if(DEFINED KDEPIM_DEV_VERSION)
124   set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}")
125 endif()
127 set(KDEPIM_VERSION "4.8${KDEPIM_DEV_VERSION}")
129 configure_file(kdepim-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdepim-version.h @ONLY)
131 ############### search packages used by KDE ###############
133 # It is needed otherwise it finds the kde4-config of the target platform
134 if(WINCE)
135 find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config PATHS ${HOST_BINDIR} NO_DEFAULT_PATH)
136 endif(WINCE)
138 find_package(KDE4 4.7.0 REQUIRED)
139 include(KDE4Defaults)
140 include(MacroLibrary)
141 include(CheckIncludeFiles)
142 include(MacroBoolTo01)
143 find_package(KdepimLibs 4.7.41 REQUIRED)
145 ############### Load the CTest options ###############
147 # CMake is irritating and doesn't allow setting the tests timeout globally.
148 # Let's work around this. The global timeout is now 2 minutes.
149 set(_DartConfigFile "${CMAKE_BINARY_DIR}/DartConfiguration.tcl")
150 if(EXISTS ${_DartConfigFile})
151   set(DartTestingTimeout "120")
152   file(READ ${_DartConfigFile} _DartConfigFile_content)
153   string(REGEX REPLACE "TimeOut: 1500" "TimeOut: ${DartTestingTimeout}" _DartConfigFile_content ${_DartConfigFile_content})
154   file(WRITE ${_DartConfigFile} ${_DartConfigFile_content})
155 endif()
157 # CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
158 # in the KDE build system, this is the same as CMAKE_BINARY_DIR.
159 configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
162 ############### search Boost ###############
164 find_package(Boost 1.34.0)
165 macro_log_feature(Boost_FOUND "Boost" "Boost C++ Libraries" "http://www.boost.org" TRUE "1.34.0" "Required by several critical KDEPIM apps.")
167 # Kleopatra needs to know if the topological.hpp header exists (part of Boost_graph).
168 find_path(Boost_TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
169 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")
172 ############### Windows specific ###############
174 if(WIN32)
175   # detect oxygen icon dir at configure time based on KDEDIRS - there may be different package installation locations
176   execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
177   file(TO_CMAKE_PATH "${_dir}" __dir)
178   find_path(KDE4_ICON_DIR oxygen PATHS
179     ${__dir}
180   )
181   message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")
182 else(WIN32)
183     set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
184 endif(WIN32)
187 ############### ONLY_KLEO ###############
189 # The KDEPIM_ONLY_KLEO option is true
190 if(KDEPIM_ONLY_KLEO)
191   find_package(QGpgme)
192   macro_log_feature(QGPGME_FOUND "QGpgME" "The QGpgME library" "http://www.kde.org" TRUE "" "QGpgME is required to build Kleopatra.")
194   add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS} -DQT3_SUPPORT_WARNINGS)
195   include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIRS} ${QT_QTDBUS_INCLUDE_DIR})
196   include(kleopatra/ConfigureChecks.cmake)
198   add_subdirectory(libkleo)
199   if (Boost_TOPOLOGICAL_SORT_DIR)
200     macro_optional_add_subdirectory(kleopatra)
201   endif (Boost_TOPOLOGICAL_SORT_DIR)
203 else(KDEPIM_ONLY_KLEO)
205 # Otherwise...
206 ############### Find the stuff we need ###############
207   set(AKONADI_MIN_VERSION 1.4.91)
208   find_package(Akonadi QUIET NO_MODULE ${AKONADI_MIN_VERSION})
209   macro_log_feature(Akonadi_FOUND "Akonadi" "Akonadi server libraries" "http://pim.kde.org/akonadi" TRUE "${AKONADI_MIN_VERSION}" "Akonadi is required to build KDEPIM")
211   find_package(ZLIB)
212   macro_log_feature(ZLIB_FOUND "ZLib" "The Zlib compression library" "http://www.zlib.net" TRUE "" "")
214   find_package(Strigi)
215   macro_log_feature(STRIGI_FOUND "Strigi" "Index metadata of files" "http://strigi.sourceforge.net" TRUE "" "")
217   find_package(QGpgme)
218   macro_log_feature(QGPGME_FOUND "QGpgME" "The QGpgME library" "http://www.kde.org" FALSE "" "QGpgME is required to build KMail, KOrganizer and Kleopatra")
220   set(SDO_MIN_VERSION 0.6.51)
221   set(SOPRANO_MIN_VERSION 2.3.70)
223   find_package(SharedDesktopOntologies ${SDO_MIN_VERSION})
224   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.")
226   find_package(Soprano)
227   macro_log_feature(Soprano_FOUND "Soprano" "Semantic Desktop Storing" "http://soprano.sourceforge.net" TRUE "${SOPRANO_MIN_VERSION}" "Soprano is needed for Nepomuk")
228   include(SopranoAddOntology)
230   find_package(Grantlee QUIET NO_MODULE)
231   macro_log_feature(Grantlee_FOUND "Grantlee" "The Grantlee Template System" "http://www.grantlee.org" FALSE "" "Templating and theming for KJots and KaddressBook." )
233 if(NOT KDEPIM_NO_NEPOMUK)
234   find_package(Nepomuk)
235   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")
236 endif(NOT KDEPIM_NO_NEPOMUK)
237   
238   find_package(LibXslt)
239   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.")
241 ############### Desktop vs. Mobile options ##############
243 if (KDEPIM_MOBILE_UI)
244   macro_log_feature(QT_QTDECLARATIVE_FOUND "QtDeclarative" "Qt Declarative (QML) module" "http://qt.nokia.com" TRUE "4.7" "Required for building mobile UI")
245   add_definitions( -DKDEPIM_MOBILE_UI )
246 else()
247   macro_log_feature(QT_QTDECLARATIVE_FOUND "QtDeclarative" "Qt Declarative (QML) module" "http://qt.nokia.com" FALSE "4.7" "Required for building the mobile applications")
248   if (NOT QT_QTDECLARATIVE_FOUND)
249     message(STATUS "The Qt Declarative (QML) module was not found. The mobile applications will not be built.")
250     set(KDEPIM_BUILD_MOBILE FALSE)
251   endif()
252 endif()
254 ############### Needed commands before building anything ###############
256 add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS} ${AKONADI_DEFINITIONS})
258 include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/libkdepim  ${Boost_INCLUDE_DIR})
260 if (NOT KDEPIMLIBS_KRESOURCES_LIBRARY)
261   add_definitions( -DKDEPIM_NO_KRESOURCES )
262 endif (NOT KDEPIMLIBS_KRESOURCES_LIBRARY)
264 ############### Macros ###############
266 # generates a D-Bus interface description from a KConfigXT file
267 macro(kcfg_generate_dbus_interface _kcfg _name)
268   add_custom_command(
269     OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_name}.xml
270     COMMAND ${XSLTPROC_EXECUTABLE} --stringparam interfaceName ${_name}
271     ${KDEPIMLIBS_DATA_DIR}/akonadi-kde/kcfg2dbus.xsl
272     ${_kcfg}
273     > ${CMAKE_CURRENT_BINARY_DIR}/${_name}.xml
274     DEPENDS ${KDEPIMLIBS_DATA_DIR}/akonadi-kde/kcfg2dbus.xsl
275     ${_kcfg}
276     )
277 endmacro(kcfg_generate_dbus_interface)
280 ############### Code used in several places ###############
281 # TODO Remove from the top CMakeLists.
283 # used in knotes, kontact/plugins/knotes, kresources/egroupware, kresources/kolab/knotes, kresources/scalix/knotes, wizard
284 set(libknotesresources_SRCS
285   ${CMAKE_SOURCE_DIR}/knotes/resourcemanager.cpp
286   ${CMAKE_SOURCE_DIR}/knotes/resourcenotes.cpp
287   ${CMAKE_SOURCE_DIR}/knotes/resourcelocal.cpp
288   ${CMAKE_SOURCE_DIR}/knotes/resourcelocalconfig.cpp
291 # used in knotes, kontact/plugins/knotes
292 set(libknoteseditor_SRCS
293   ${CMAKE_SOURCE_DIR}/knotes/knoteedit.cpp
296 ############### Now, we add the PIM components ###############
298   include (kleopatra/ConfigureChecks.cmake)
300   # These targets will always be built before anything else.
302   add_subdirectory(ontologies) # must be the first one.
303   add_subdirectory(akonadi_next)
304   add_subdirectory(libkdepim)
305   add_subdirectory(calendarsupport)
306   add_subdirectory(calendarviews)
307   add_subdirectory(incidenceeditor-ng)
308   add_subdirectory(libkdepimdbusinterfaces)
309   add_subdirectory(libkleo)
310   add_subdirectory(libkpgp)
311   add_subdirectory(libksieve)
312   add_subdirectory(kdgantt2)
313   add_subdirectory(icons)
314   add_subdirectory(messagecore)
315 if (NOT WINCE)
316   add_subdirectory(messagelist)
317 else (NOT WINCE)
318   # We need to compile runtime in kdepim because of the static
319   # linking of korgac and the applications need to link against
320   # plugins like the serializer plugins. If the korgac would
321   # move to runtime this can be avoided
322   add_subdirectory(runtime)
323 endif (NOT WINCE)
324   add_subdirectory(templateparser)
326   if(QGPGME_FOUND)
327     if (Boost_TOPOLOGICAL_SORT_DIR)
328       macro_optional_add_subdirectory(kleopatra)
329     endif(Boost_TOPOLOGICAL_SORT_DIR)
330     if (QT_QT3SUPPORT_FOUND AND KDEPIMLIBS_KRESOURCES_LIBRARY)
331       macro_optional_add_subdirectory(wizards)
332     endif (QT_QT3SUPPORT_FOUND AND KDEPIMLIBS_KRESOURCES_LIBRARY)
333     # The following components depend on QGpgME.
334     set(MESSAGEVIEWER_SUPPORTED TRUE)
335     add_subdirectory(messageviewer)
336     macro_optional_add_subdirectory(messagecomposer)
337     add_subdirectory(mailcommon) # TODO: does this make sense?!?
338     add_subdirectory(mailfilteragent)
339     macro_optional_add_subdirectory(kmail)
340     if (KDEPIM_BUILD_MOBILE)
341       add_subdirectory(mobile)
342     endif (KDEPIM_BUILD_MOBILE)
344     if(KDEPIM_BUILD_EXAMPLES)
345       add_subdirectory(examples)
346     endif(KDEPIM_BUILD_EXAMPLES)
348     # If kmail is compiled, KMAIL_SUPPORTED is true (used in several places)
349     if(BUILD_kmail)
350       set(KMAIL_SUPPORTED TRUE)
351       add_definitions(-DKMAIL_SUPPORTED)
352     endif(BUILD_kmail)
354     if (KDEPIM_BUILD_DESKTOP)
355       macro_optional_add_subdirectory(kmailcvt)
356       macro_optional_add_subdirectory(ksendemail)
357     endif (KDEPIM_BUILD_DESKTOP)
359     macro_optional_add_subdirectory(korganizer)
361     # disabled until Strigi dep is removed
362     if (NOT WINCE AND NOT KDEPIM_NO_NEPOMUK)
363       if (NOT WIN32)
364         # The nepomuk_email_feeder uses symbols from kde-runtime.
365         # On Windows you can not link a DLL with undefined
366         # Symbols so this has to be disabled
367         if (SHAREDDESKTOPONTOLOGIES_VERSION VERSION_GREATER 0.3.59)
368           add_subdirectory( nepomuk_email_feeder )
369         endif (SHAREDDESKTOPONTOLOGIES_VERSION VERSION_GREATER 0.3.59)
370       else (NOT WIN32)
371         message(STATUS "The akonadi_nepomuk_email_feeder will not be built.")
372       endif(NOT WIN32)
373     endif()
374   endif(QGPGME_FOUND)
376   if(KDEPIM_BUILD_EVERYTHING AND QT_QT3SUPPORT_FOUND AND KDEPIMLIBS_KRESOURCES_LIBRARY AND KDEPIM_BUILD_DESKTOP)
377     macro_optional_add_subdirectory(knode)
378   endif(KDEPIM_BUILD_EVERYTHING AND QT_QT3SUPPORT_FOUND AND KDEPIMLIBS_KRESOURCES_LIBRARY AND KDEPIM_BUILD_DESKTOP)
380   if (KDEPIM_BUILD_DESKTOP)
381     macro_optional_add_subdirectory(akregator)
382   endif (KDEPIM_BUILD_DESKTOP)
383   macro_optional_add_subdirectory(akonadiconsole)
384   if (KDEPIMLIBS_KCAL_LIBRARY AND KDEPIM_BUILD_DESKTOP)
385     macro_optional_add_subdirectory(blogilo)
386   endif (KDEPIMLIBS_KCAL_LIBRARY AND KDEPIM_BUILD_DESKTOP)
387   macro_optional_add_subdirectory(console)
389   if (Grantlee_FOUND AND KDEPIM_BUILD_DESKTOP)
390     macro_optional_add_subdirectory(kjots)
391   endif (Grantlee_FOUND AND KDEPIM_BUILD_DESKTOP)
392   if (KDEPIMLIBS_KRESOURCES_LIBRARY)
393     macro_optional_add_subdirectory(knotes)
394   endif (KDEPIMLIBS_KRESOURCES_LIBRARY)
395   macro_optional_add_subdirectory(strigi-analyzer)
397   if (KDEPIMLIBS_KRESOURCES_LIBRARY AND NOT MINGW AND KDEPIM_BUILD_DESKTOP)
398     macro_optional_add_subdirectory(kalarm)
399   endif (KDEPIMLIBS_KRESOURCES_LIBRARY AND NOT MINGW AND KDEPIM_BUILD_DESKTOP)
401   if (KDEPIM_BUILD_DESKTOP)
402     macro_optional_add_subdirectory(kaddressbook)
403   endif (KDEPIM_BUILD_DESKTOP)
404   if(Q_WS_X11 AND KDEPIMLIBS_KRESOURCES_LIBRARY AND KDEPIM_BUILD_DESKTOP)
405     macro_optional_add_subdirectory(ktimetracker)
406   endif(Q_WS_X11 AND KDEPIMLIBS_KRESOURCES_LIBRARY AND KDEPIM_BUILD_DESKTOP)
408   if (KDEPIM_BUILD_DESKTOP)
409     macro_optional_add_subdirectory(kontact) # must be the last one.
410   endif (KDEPIM_BUILD_DESKTOP)
412   # These targets depend on optional applications
413   if (KDEPIMLIBS_KRESOURCES_LIBRARY)
414     add_subdirectory(kresources) # Must be after KAddressbook
415   endif (KDEPIMLIBS_KRESOURCES_LIBRARY)
416   add_subdirectory(plugins) # Must be after KMail
418 endif (KDEPIM_ONLY_KLEO)
420 # doc must be a subdir of kdepim or packagers will kill us
421 macro_optional_add_subdirectory(doc)
424 # We really want to encourage users to enable/install QGpgME from kdepimlibs
425 if(NOT QGPGME_FOUND)
426   # Users must be aware that QGpgMe is really needed
427   message(STATUS "*** WARNING: QGpgME is not installed on your system ***")
428   message(STATUS "*** It is required if you want to use KMail, KOrganizer or Kleopatra ***")
429   message(STATUS "*** You are really encouraged to install it ***")
430 endif(NOT QGPGME_FOUND)
431 # All done, let's display what we found...
432 macro_display_feature_log()