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_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
26 add_definitions(-DKDEPIM_NO_WEBKIT)
29 # cmake would not find kde for xcompile if that is not set
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)
37 if(KDEPIM_ENTERPRISE_BUILD)
38 message(STATUS "Enterprise build is enabled.")
41 # if KDEPIM_ONLY_KLEO is defined, KDEPIM_BUILD_MOBILE and KDEPIM_MOBILE_UI are disabled.
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.")
50 # Build the mobile applications
51 set(KDEPIM_BUILD_MOBILE TRUE)
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")
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}")
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
94 set(KDEPIM_DEV_VERSION)
97 if(DEFINED KDEPIM_DEV_VERSION)
98 set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}")
101 set(KDEPIM_VERSION "4.12.2${KDEPIM_DEV_VERSION}")
103 configure_file(kdepim-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdepim-version.h @ONLY)
105 ############### search packages used by KDE ###############
107 # It is needed otherwise it finds the kde4-config of the target platform
109 find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config PATHS ${HOST_BINDIR} NO_DEFAULT_PATH)
112 find_package(KDE4 4.11.3 REQUIRED)
113 include(KDE4Defaults)
115 find_package(KdepimLibs 4.12.2)
116 set_package_properties(KdepimLibs PROPERTIES DESCRIPTION "The KDEPIM libraries" URL "http://www.kde.org" TYPE REQUIRED)
118 ############### Load the CTest options ###############
120 # CMake is irritating and doesn't allow setting the tests timeout globally.
121 # Let's work around this. The global timeout is now 2 minutes.
122 set(_DartConfigFile "${CMAKE_BINARY_DIR}/DartConfiguration.tcl")
123 if(EXISTS ${_DartConfigFile})
124 set(DartTestingTimeout "120")
125 file(READ ${_DartConfigFile} _DartConfigFile_content)
126 string(REGEX REPLACE "TimeOut: 1500" "TimeOut: ${DartTestingTimeout}" _DartConfigFile_content ${_DartConfigFile_content})
127 file(WRITE ${_DartConfigFile} ${_DartConfigFile_content})
130 # CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
131 # in the KDE build system, this is the same as CMAKE_BINARY_DIR.
132 configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
134 ############### search Boost ###############
136 find_package(Boost 1.34.0)
137 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")
139 # Kleopatra needs to know if the topological.hpp header exists (part of Boost_graph).
140 find_path(Boost_TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
141 if(Boost_TOPOLOGICAL_SORT_DIR)
142 message(STATUS "The Boost Topological_sort header was found. Building Kleopatra")
144 message(STATUS "The Boost Topological_sort header was NOT found. Kleopatra will not be built")
147 ############### Windows specific ###############
150 # detect oxygen icon dir at configure time based on KDEDIRS - there may be different package installation locations
151 execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
152 file(TO_CMAKE_PATH "${_dir}" __dir)
153 find_path(KDE4_ICON_DIR oxygen PATHS
156 message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")
158 set (KDE4_ICON_DIR ${CMAKE_INSTALL_PREFIX}/share/icons)
161 ############### ONLY_KLEO ###############
163 # If the KDEPIM_ONLY_KLEO option is true
166 set_package_properties(QGpgme PROPERTIES DESCRIPTION "The QGpgME library" URL "http://www.kde.org" TYPE REQUIRED PURPOSE "QGpgME is required to build Kleopatra.")
168 add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS})
169 include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIRS} ${QT_QTDBUS_INCLUDE_DIR})
170 include(kleopatra/ConfigureChecks.cmake)
172 add_subdirectory(libkleo)
173 if(Boost_TOPOLOGICAL_SORT_DIR)
174 add_subdirectory(kleopatra)
179 ############### Find the stuff we need ###############
181 find_package(Akonadi 1.10.45 QUIET CONFIG)
182 set_package_properties(Akonadi PROPERTIES DESCRIPTION "Akonadi server libraries" URL "http://pim.kde.org/akonadi" TYPE REQUIRED PURPOSE "Akonadi is required to build KDEPIM")
185 set_package_properties(ZLIB PROPERTIES DESCRIPTION "The Zlib compression library" URL "http://www.zlib.net" TYPE REQUIRED)
187 # Strigi is required only if AKONADI_USE_STRIGI_SEARCH is true in AkonadiConfig.cmake
188 if(AKONADI_USE_STRIGI_SEARCH)
190 set_package_properties(Strigi PROPERTIES URL "https://projects.kde.org/strigi" TYPE REQUIRED PURPOSE "Metadata indexing")
194 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")
196 find_package(SharedDesktopOntologies 0.11)
197 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")
199 find_package(Soprano 2.9.0)
200 set_package_properties(Soprano PROPERTIES DESCRIPTION "C++/Qt4 framework for RDF data" URL "http://soprano.sourceforge.net" TYPE REQUIRED PURPOSE "Storage of semantic data")
201 include(SopranoAddOntology)
203 find_package(Grantlee 0.3.0 QUIET CONFIG)
204 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)." )
206 find_package(NepomukCore QUIET CONFIG)
207 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")
209 find_package(NepomukWidgets QUIET CONFIG)
210 set_package_properties(NepomukWidgets PROPERTIES DESCRIPTION "The NepomukWidget libraries" URL "http://www.kde.org" TYPE RECOMMENDED PURPOSE "Nepomuk-widgets is needed for building Akonadiconsole")
213 find_package(Xsltproc)
214 set_package_properties(Xsltproc PROPERTIES DESCRIPTION "XSLT processor from libxslt" TYPE REQUIRED PURPOSE "Required to generate D-Bus interfaces.")
217 set_package_properties(QJSON PROPERTIES DESCRIPTION "QJSON" URL "http://qjson.sourceforge.net/" TYPE REQUIRED PURPOSE "Qt library for handling JSON data")
219 find_package(Prison QUIET CONFIG)
220 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")
223 ############### Desktop vs. Mobile options ##############
226 add_definitions( -DKDEPIM_MOBILE_UI )
227 if(NOT QT_QTDECLARATIVE_FOUND)
228 message(FATAL_ERROR "The QtDeclarative (QML) module is required for building the mobile UI")
231 if(NOT QT_QTDECLARATIVE_FOUND)
232 message(STATUS "The Qt Declarative (QML) module was not found. The mobile applications will not be built.")
233 set(KDEPIM_BUILD_MOBILE FALSE)
237 ############### Needed commands before building anything ###############
239 add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS} ${AKONADI_DEFINITIONS})
241 include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
243 if(NOT KDEPIMLIBS_KRESOURCES_LIBRARY)
244 add_definitions( -DKDEPIM_NO_KRESOURCES )
248 ############### Now, we add the PIM components ###############
250 include (kleopatra/ConfigureChecks.cmake)
252 # These targets will always be built before anything else.
254 add_subdirectory(ontologies) # must be the first one.
255 add_subdirectory(akonadi_next)
256 add_subdirectory(libkdepim)
257 add_subdirectory(calendarsupport)
258 add_subdirectory(calendarviews)
259 add_subdirectory(incidenceeditor-ng)
260 add_subdirectory(libkdepimdbusinterfaces)
261 add_subdirectory(libkleo)
262 add_subdirectory(libkpgp)
263 add_subdirectory(libksieve)
264 add_subdirectory(kdgantt2)
265 add_subdirectory(icons)
266 add_subdirectory(composereditor-ng)
267 add_subdirectory(grammar)
268 add_subdirectory(messagecore)
269 add_subdirectory(grantleetheme)
271 add_subdirectory(messagelist)
273 # We need to compile runtime in kdepim because of the static
274 # linking of korgac and the applications need to link against
275 # plugins like the serializer plugins. If the korgac would
276 # move to runtime this can be avoided
277 add_subdirectory(runtime)
279 add_subdirectory(templateparser)
282 if(Boost_TOPOLOGICAL_SORT_DIR)
283 macro_optional_add_subdirectory(kleopatra)
287 # The following components depend on QGpgME.
288 add_subdirectory(messageviewer)
289 macro_optional_add_subdirectory(messagecomposer)
290 add_subdirectory(pimcommon)
291 add_subdirectory(mailcommon) # TODO: does this make sense?!?
292 macro_optional_add_subdirectory(kmail)
293 macro_optional_add_subdirectory(headerthemeeditor)
294 macro_optional_add_subdirectory(contactthemeeditor)
295 add_subdirectory(grantleethemeeditor)
297 if(KDEPIM_BUILD_MOBILE)
298 add_subdirectory(mobile)
301 if(KDEPIM_BUILD_EXAMPLES)
302 add_subdirectory(examples)
305 # If kmail is compiled, KMAIL_SUPPORTED is true (used in several places)
307 set(KMAIL_SUPPORTED TRUE)
308 add_definitions(-DKMAIL_SUPPORTED)
311 macro_optional_add_subdirectory(pimactivity)
312 macro_optional_add_subdirectory(korganizer)
313 macro_optional_add_subdirectory(korgac)
314 add_subdirectory(kaddressbookgrantlee)
315 if(KDEPIM_BUILD_DESKTOP)
316 macro_optional_add_subdirectory(agents)
317 macro_optional_add_subdirectory(akregator)
318 macro_optional_add_subdirectory(importwizard)
319 macro_optional_add_subdirectory(kaddressbook)
320 macro_optional_add_subdirectory(kmailcvt)
321 macro_optional_add_subdirectory(mboximporter)
322 macro_optional_add_subdirectory(knotes)
323 macro_optional_add_subdirectory(ksendemail)
324 macro_optional_add_subdirectory(ktnef)
325 macro_optional_add_subdirectory(mailimporter)
326 macro_optional_add_subdirectory(pimsettingexporter)
327 macro_optional_add_subdirectory(kalarm)
329 if(KDEPIMLIBS_KCAL_LIBRARY)
330 macro_optional_add_subdirectory(blogilo)
333 macro_optional_add_subdirectory(kjots)
335 if(KDEPIMLIBS_KRESOURCES_LIBRARY)
336 if(QT_QT3SUPPORT_FOUND)
337 macro_optional_add_subdirectory(knode)
341 macro_optional_add_subdirectory(ktimetracker)
345 macro_optional_add_subdirectory(kontact) # must be the last one.
348 if(NepomukWidgets_FOUND)
349 macro_optional_add_subdirectory(akonadiconsole)
351 macro_optional_add_subdirectory(console)
353 macro_optional_add_subdirectory(strigi-analyzer)
356 # These targets depend on optional applications
357 if(KDEPIMLIBS_KRESOURCES_LIBRARY)
358 add_subdirectory(kresources) # Must be after KAddressbook
361 add_subdirectory(plugins) # Must be after KMail
365 # doc must be a subdir of kdepim or packagers will kill us
366 macro_optional_add_subdirectory(doc)
368 # All done, let's display what we found...
369 feature_summary(WHAT ALL
370 INCLUDE_QUIET_PACKAGES
371 FATAL_ON_MISSING_REQUIRED_PACKAGES