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_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_ONLY_KLEO "Only build Kleopatra. This option will disable KDEPIM_BUILD_EVERYTHING and KDEPIM_ENTERPRISE_BUILD." FALSE)
13 # if KDEPIM_ENTERPRISE_BUILD is defined, KDEPIM_ONLY_KLEO is disabled
14 if(KDEPIM_ENTERPRISE_BUILD)
15 set(KDEPIM_ONLY_KLEO FALSE)
16 set(KDEPIM_BUILD_EVERYTHING FALSE)
17 message(STATUS "Enterprise build is enabled.")
18 else(KDEPIM_ENTERPRISE_BUILD)
19 # if KDEPIM_ONLY_KLEO is defined, KDEPIM_BUILD_EVERYTHING is disabled.
21 set(KDEPIM_BUILD_EVERYTHING FALSE)
22 set(KDEPIM_DEFINITIONS "-DHAVE_CONFIG_H=1")
23 message(STATUS "Only libkleo and Kleopatra will be built.")
24 endif(KDEPIM_ONLY_KLEO)
26 set(KDEPIM_BUILD_EVERYTHING TRUE)
27 message(STATUS "Enterprise build is disabled.")
28 endif(KDEPIM_ENTERPRISE_BUILD)
30 # config-enterprise.h is needed for both ENTERPRISE_BUILD and BUILD_EVERYTHING
31 configure_file(config-enterprise.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-enterprise.h )
33 ############### generate kdepim-version.h ###############
34 # Support for the SVN revision number in kdepim-version.h
35 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn")
36 if (NOT KdeSubversion_FOUND)
37 find_package(KdeSubversion)
38 endif (NOT KdeSubversion_FOUND)
39 if (KdeSubversion_FOUND)
40 KdeSubversion_WC_INFO(${PROJECT_SOURCE_DIR} KDEPIM)
41 string(SUBSTRING "${KDEPIM_WC_LAST_CHANGED_DATE}" 0 10 KDEPIM_WC_LAST_CHANGED_DATE)
42 set(kdepim_svn_revision "svn-${KDEPIM_WC_REVISION}")
43 set(kdepim_svn_last_change "${KDEPIM_WC_LAST_CHANGED_DATE}")
44 endif (KdeSubversion_FOUND)
45 endif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn")
47 configure_file(kdepim-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdepim-version.h)
49 ############### search packages used by KDE ###############
51 find_package(KDE4 REQUIRED)
54 include(CheckIncludeFiles)
55 include(MacroBoolTo01)
56 find_package(KdepimLibs 4.5.60 REQUIRED)
58 ### remove the following when requiring kdelibs 4.5 ###
59 if ( NOT KDE4_KCMUTILS_LIBS )
60 set( KDE4_KCMUTILS_LIBS ${KDE4_KUTILS_LIBS} )
62 if ( NOT KDE4_KEMOTICONS_LIBS )
63 set( KDE4_KEMOTICONS_LIBS ${KDE4_KUTILS_LIBS} )
65 ### end of 4.4 compat code ###
67 ############### Load the CTest options ###############
68 # Set a timeout value of 5 minutes per test
69 set(DART_TESTING_TIMEOUT 300)
71 # CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
72 # in the KDE build system, this is the same as CMAKE_BINARY_DIR.
73 configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
76 ############### search Boost ###############
78 find_package(Boost 1.34.0)
79 macro_log_feature(Boost_FOUND "Boost" "Boost C++ Libraries" "http://www.boost.org" TRUE "1.34.0" "Required by several critical KDEPIM apps.")
81 # Kleopatra needs to know if the topological.hpp header exists (part of Boost_graph).
82 find_path(Boost_TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
83 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")
86 ############### Windows specific ###############
89 # detect oxygen icon dir at configure time based on KDEDIRS - there may be different package installation locations
90 execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
91 file(TO_CMAKE_PATH "${_dir}" __dir)
92 find_path(KDE4_ICON_DIR oxygen PATHS
95 message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")
97 set (KDE4_ICON_DIR ${CMAKE_INSTALL_PREFIX}/share/icons)
101 ############### ONLY_KLEO ###############
103 # The KDEPIM_ONLY_KLEO option is true
106 macro_log_feature(QGPGME_FOUND "QGpgME" "The QGpgME library" "http://www.kde.org" TRUE "" "QGpgME is required to build Kleopatra.")
108 add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS} -DQT3_SUPPORT_WARNINGS)
109 include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIRS} ${QT_QTDBUS_INCLUDE_DIR})
110 include(kleopatra/ConfigureChecks.cmake)
112 add_subdirectory(libkleo)
113 if (Boost_TOPOLOGICAL_SORT_DIR)
114 macro_optional_add_subdirectory(kleopatra)
115 endif (Boost_TOPOLOGICAL_SORT_DIR)
117 else(KDEPIM_ONLY_KLEO)
120 ############### Find the stuff we need ###############
122 find_package(Akonadi QUIET NO_MODULE 1.3.60)
123 macro_log_feature(Akonadi_FOUND "Akonadi" "Akonadi server libraries" "http://pim.kde.org/akonadi" TRUE "" "Akonadi is required to build KDEPIM")
126 macro_log_feature(ZLIB_FOUND "ZLib" "The Zlib compression library" "http://www.zlib.net" TRUE "" "")
129 macro_log_feature(STRIGI_FOUND "Strigi" "Index metadata of files" "http://strigi.sourceforge.net" TRUE "" "")
132 macro_log_feature(QGPGME_FOUND "QGpgME" "The QGpgME library" "http://www.kde.org" FALSE "" "QGpgME is required to build KMail, KOrganizer and Kleopatra")
134 set(SDO_MIN_VERSION 0.2)
135 set(SOPRANO_MIN_VERSION 2.3.70)
137 find_package(SharedDesktopOntologies ${SDO_MIN_VERSION})
138 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.")
140 find_package(Soprano)
141 macro_log_feature(Soprano_FOUND "Soprano" "Semantic Desktop Storing" "http://soprano.sourceforge.net" TRUE "${SOPRANO_MIN_VERSION}" "Soprano is needed for Nepomuk")
142 include(SopranoAddOntology)
144 find_package(Grantlee QUIET NO_MODULE)
145 macro_log_feature(Grantlee_FOUND "Grantlee" "The Grantlee Template System" "http://www.grantlee.org" FALSE "" "Templating and theming for KJots." )
147 find_package(Nepomuk)
148 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")
150 find_program(XSLTPROC_EXECUTABLE xsltproc)
151 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.")
153 ############### Desktop vs. Mobile options ##############
155 option(KDEPIM_MOBILE_UI "Build UI for mobile devices instead of for desktops" FALSE)
156 if (KDEPIM_MOBILE_UI)
157 macro_log_feature(QT_QTDECLARATIVE_FOUND "QtDeclarative" "Qt Declarative (QML) module" "http://qt.nokia.com" TRUE "4.7" "Required for building mobile UI")
158 add_definitions( -DKDEPIM_MOBILE_UI )
159 endif (KDEPIM_MOBILE_UI)
161 ############### Needed commands before building anything ###############
163 add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS})
165 include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/libkdepim)
167 if (NOT KDEPIMLIBS_KRESOURCES_LIBRARY)
168 add_definitions( -DKDEPIM_NO_KRESOURCES )
169 endif (NOT KDEPIMLIBS_KRESOURCES_LIBRARY)
172 ############### Macros ###############
174 # generates a D-Bus interface description from a KConfigXT file
175 macro(kcfg_generate_dbus_interface _kcfg _name)
177 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_name}.xml
178 COMMAND ${XSLTPROC_EXECUTABLE} --stringparam interfaceName ${_name}
179 ${KDEPIMLIBS_DATA_DIR}/akonadi-kde/kcfg2dbus.xsl
181 > ${CMAKE_CURRENT_BINARY_DIR}/${_name}.xml
182 DEPENDS ${KDEPIMLIBS_DATA_DIR}/akonadi-kde/kcfg2dbus.xsl
185 endmacro(kcfg_generate_dbus_interface)
188 ############### Code used in several places ###############
189 # TODO Remove from the top CMakeLists.
191 # used in knotes, kontact/plugins/knotes, kresources/egroupware, kresources/kolab/knotes, kresources/scalix/knotes, wizard
192 set(libknotesresources_SRCS
193 ${CMAKE_SOURCE_DIR}/knotes/resourcemanager.cpp
194 ${CMAKE_SOURCE_DIR}/knotes/resourcenotes.cpp
195 ${CMAKE_SOURCE_DIR}/knotes/resourcelocal.cpp
196 ${CMAKE_SOURCE_DIR}/knotes/resourcelocalconfig.cpp
199 # used in knotes, kontact/plugins/knotes
200 set(libknoteseditor_SRCS
201 ${CMAKE_SOURCE_DIR}/knotes/knoteedit.cpp
204 # used in kdgantt1, korganizer
206 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttView.cpp
207 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewEventItem.cpp
208 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewItem.cpp
209 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewItemDrag.cpp
210 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewSubwidgets.cpp
211 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewSummaryItem.cpp
212 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewTaskItem.cpp
213 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewTaskLink.cpp
214 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewTaskLinkGroup.cpp
215 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttMinimizeSplitter.cpp
216 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttSemiSizingControl.cpp
217 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttSizingControl.cpp
218 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttXMLTools.cpp
222 ############### Now, we add the PIM components ###############
224 include (kleopatra/ConfigureChecks.cmake)
226 # These targets will always be built before anything else.
228 add_subdirectory( ontologies ) # must be the first one.
229 add_subdirectory(akonadi)
230 add_subdirectory(libkdepim)
231 add_subdirectory(calendarviews)
232 add_subdirectory( incidenceeditors )
233 add_subdirectory(libkdepimdbusinterfaces)
234 add_subdirectory(libkleo)
235 add_subdirectory(libkpgp)
236 add_subdirectory(libksieve)
237 #add_subdirectory(libstickynotes)
238 add_subdirectory(kdgantt1)
239 add_subdirectory(kdgantt2)
240 add_subdirectory(icons)
241 add_subdirectory(messagecore)
242 add_subdirectory(messagelist)
243 add_subdirectory(templateparser)
246 if (Boost_TOPOLOGICAL_SORT_DIR)
247 macro_optional_add_subdirectory(kleopatra)
248 endif(Boost_TOPOLOGICAL_SORT_DIR)
249 if (QT_QT3SUPPORT_FOUND AND KDEPIMLIBS_KRESOURCES_LIBRARY)
250 macro_optional_add_subdirectory(wizards)
251 endif (QT_QT3SUPPORT_FOUND AND KDEPIMLIBS_KRESOURCES_LIBRARY)
252 # The following components depend on QGpgME.
253 set(MESSAGEVIEWER_SUPPORTED TRUE)
254 add_subdirectory(messageviewer)
255 macro_optional_add_subdirectory(messagecomposer)
256 macro_optional_add_subdirectory(kmail)
257 if (QT_QTDECLARATIVE_FOUND AND KDEPIM_MOBILE_UI)
258 # temporarily disabled, until the komo branch merge is complete
259 # macro_optional_add_subdirectory(mobile)
260 endif (QT_QTDECLARATIVE_FOUND AND KDEPIM_MOBILE_UI)
262 if(KDEPIM_BUILD_EXAMPLES)
263 add_subdirectory(examples)
264 endif(KDEPIM_BUILD_EXAMPLES)
266 # If kmail is compiled, KMAIL_SUPPORTED is true (used in several places)
268 set(KMAIL_SUPPORTED TRUE)
269 add_definitions(-DKMAIL_SUPPORTED)
272 macro_optional_add_subdirectory(kmailcvt)
273 macro_optional_add_subdirectory(ksendemail)
274 macro_optional_add_subdirectory(korganizer)
276 if (SHAREDDESKTOPONTOLOGIES_VERSION VERSION_GREATER 0.3.59)
277 add_subdirectory( nepomuk_email_feeder )
281 if(KDEPIM_BUILD_EVERYTHING AND QT_QT3SUPPORT_FOUND AND KDEPIMLIBS_KRESOURCES_LIBRARY)
282 macro_optional_add_subdirectory(knode)
283 endif(KDEPIM_BUILD_EVERYTHING AND QT_QT3SUPPORT_FOUND AND KDEPIMLIBS_KRESOURCES_LIBRARY)
285 if (QT_QT3SUPPORT_FOUND)
286 macro_optional_add_subdirectory(akregator)
287 endif (QT_QT3SUPPORT_FOUND)
288 macro_optional_add_subdirectory(akonadiconsole)
289 macro_optional_add_subdirectory(blogilo)
290 macro_optional_add_subdirectory(console)
291 if (KDEPIMLIBS_KRESOURCES_LIBRARY AND NOT MINGW)
292 macro_optional_add_subdirectory(kalarm)
293 endif (KDEPIMLIBS_KRESOURCES_LIBRARY AND NOT MINGW)
296 macro_optional_add_subdirectory(kjots)
297 endif (Grantlee_FOUND)
298 if (KDEPIMLIBS_KRESOURCES_LIBRARY)
299 macro_optional_add_subdirectory(knotes)
300 endif (KDEPIMLIBS_KRESOURCES_LIBRARY)
301 macro_optional_add_subdirectory(strigi-analyzer)
303 if(EXISTS ${CMAKE_SOURCE_DIR}/runtime)
304 macro_optional_add_subdirectory(runtime)
305 endif(EXISTS ${CMAKE_SOURCE_DIR}/runtime)
308 include_directories(${CMAKE_SOURCE_DIR}/runtime ${CMAKE_BINARY_DIR}/runtime)
309 endif (BUILD_runtime)
311 macro_optional_add_subdirectory(kaddressbook)
312 if(Q_WS_X11 AND KDEPIMLIBS_KRESOURCES_LIBRARY)
313 macro_optional_add_subdirectory(ktimetracker)
314 endif(Q_WS_X11 AND KDEPIMLIBS_KRESOURCES_LIBRARY)
316 if (QT_QT3SUPPORT_FOUND)
317 macro_optional_add_subdirectory(kontact) # must be the last one.
318 endif (QT_QT3SUPPORT_FOUND)
320 # These targets depend on optional applications
321 if (KDEPIMLIBS_KRESOURCES_LIBRARY)
322 add_subdirectory(kresources) # Must be after KAddressbook
323 endif (KDEPIMLIBS_KRESOURCES_LIBRARY)
324 add_subdirectory(plugins) # Must be after KMail
326 endif (KDEPIM_ONLY_KLEO)
328 # doc must be a subdir of kdepim or packagers will kill us
329 macro_optional_add_subdirectory(doc)
332 # We really want to encourage users to enable/install QGpgME from kdepimlibs
334 # Users must be aware that QGpgMe is really needed
335 message(STATUS "*** WARNING: QGpgME is not installed on your system ***")
336 message(STATUS "*** It is required if you want to use KMail, KOrganizer or Kleopatra ***")
337 message(STATUS "*** You are really encouraged to install it ***")
338 endif(NOT QGPGME_FOUND)
339 # All done, let's display what we found...
340 macro_display_feature_log()