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.3.85 REQUIRED)
59 ############### Load the CTest options ###############
60 # CTestCustom.cmake has to be in the CTEST_BINARY_DIR.
61 # in the KDE build system, this is the same as CMAKE_BINARY_DIR.
62 configure_file(${CMAKE_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
65 ############### search Boost ###############
67 find_package(Boost 1.34.0)
68 macro_log_feature(Boost_FOUND "Boost" "Boost C++ Libraries" "http://www.boost.org" TRUE "1.34.0" "Required by several critical KDEPIM apps.")
70 # Kleopatra needs to know if the topological.hpp header exists (part of Boost_graph).
71 find_path(Boost_TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
72 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")
75 ############### Windows specific ###############
78 # detect oxygen icon dir at configure time based on KDEDIRS - there may be different package installation locations
79 execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
80 file(TO_CMAKE_PATH "${_dir}" __dir)
81 find_path(KDE4_ICON_DIR oxygen PATHS
84 message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")
86 set (KDE4_ICON_DIR ${CMAKE_INSTALL_PREFIX}/share/icons)
90 ############### ONLY_KLEO ###############
92 # The KDEPIM_ONLY_KLEO option is true
95 macro_log_feature(QGPGME_FOUND "QGpgME" "The QGpgME library" "http://www.kde.org" TRUE "" "QGpgME is required to build Kleopatra.")
97 add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS})
98 include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KDEPIMLIBS_INCLUDE_DIRS} ${QT_QTDBUS_INCLUDE_DIR})
99 include(kleopatra/ConfigureChecks.cmake)
101 add_subdirectory(libkleo)
102 if (Boost_TOPOLOGICAL_SORT_DIR)
103 macro_optional_add_subdirectory(kleopatra)
104 endif (Boost_TOPOLOGICAL_SORT_DIR)
106 else(KDEPIM_ONLY_KLEO)
109 ############### Find the stuff we need ###############
111 find_package(Akonadi QUIET NO_MODULE)
112 macro_log_feature(Akonadi_FOUND "Akonadi" "Akonadi server libraries" "http://pim.kde.org/akonadi" TRUE "" "Akonadi is required to build KDEPIM")
115 macro_log_feature(ZLIB_FOUND "ZLib" "The Zlib compression library" "http://www.zlib.net" TRUE "" "")
118 macro_log_feature(STRIGI_FOUND "Strigi" "Index metadata of files" "http://strigi.sourceforge.net" TRUE "" "")
121 macro_log_feature(QGPGME_FOUND "QGpgME" "The QGpgME library" "http://www.kde.org" FALSE "" "QGpgME is required to build KMail, KOrganizer and Kleopatra")
123 set(SDO_MIN_VERSION 0.2)
124 set(SOPRANO_MIN_VERSION 2.3.70)
126 find_package(SharedDesktopOntologies ${SDO_MIN_VERSION})
127 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.")
129 find_package(Soprano)
130 macro_log_feature(Soprano_FOUND "Soprano" "Semantic Desktop Storing" "http://soprano.sourceforge.net" TRUE "${SOPRANO_MIN_VERSION}" "Soprano is needed for Nepomuk")
131 include(SopranoAddOntology)
133 find_package(Nepomuk)
134 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")
136 find_program(XSLTPROC_EXECUTABLE xsltproc)
137 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.")
140 ############### Needed commands before building anything ###############
142 add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ${KDEPIM_DEFINITIONS})
144 include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIRS} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/libkdepim)
147 ############### Macros ###############
149 # generates a D-Bus interface description from a KConfigXT file
150 macro(kcfg_generate_dbus_interface _kcfg _name)
152 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_name}.xml
153 COMMAND ${XSLTPROC_EXECUTABLE} --stringparam interfaceName ${_name}
154 ${KDEPIMLIBS_DATA_DIR}/akonadi-kde/kcfg2dbus.xsl
156 > ${CMAKE_CURRENT_BINARY_DIR}/${_name}.xml
157 DEPENDS ${KDEPIMLIBS_DATA_DIR}/akonadi-kde/kcfg2dbus.xsl
160 endmacro(kcfg_generate_dbus_interface)
163 ############### Code used in several places ###############
164 # TODO Remove from the top CMakeLists.
166 # used in knotes, kontact/plugins/knotes, kresources/egroupware, kresources/kolab/knotes, kresources/scalix/knotes, wizard
167 set(libknotesresources_SRCS
168 ${CMAKE_SOURCE_DIR}/knotes/resourcemanager.cpp
169 ${CMAKE_SOURCE_DIR}/knotes/resourcenotes.cpp
170 ${CMAKE_SOURCE_DIR}/knotes/resourcelocal.cpp
171 ${CMAKE_SOURCE_DIR}/knotes/resourcelocalconfig.cpp
174 # used in knotes, kontact/plugins/knotes
175 set(libknoteseditor_SRCS
176 ${CMAKE_SOURCE_DIR}/knotes/knoteedit.cpp
179 # used in kdgantt1, korganizer
181 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttView.cpp
182 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewEventItem.cpp
183 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewItem.cpp
184 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewItemDrag.cpp
185 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewSubwidgets.cpp
186 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewSummaryItem.cpp
187 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewTaskItem.cpp
188 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewTaskLink.cpp
189 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewTaskLinkGroup.cpp
190 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttMinimizeSplitter.cpp
191 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttSemiSizingControl.cpp
192 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttSizingControl.cpp
193 ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttXMLTools.cpp
197 ############### Now, we add the PIM components ###############
199 include (kleopatra/ConfigureChecks.cmake)
201 # These targets will always be built before anything else.
203 add_subdirectory( ontologies ) # must be the first one.
204 add_subdirectory(akonadi)
205 add_subdirectory(libkdepim)
206 add_subdirectory(libkdepimdbusinterfaces)
207 add_subdirectory(libkleo)
208 add_subdirectory(libkpgp)
209 add_subdirectory(libksieve)
210 add_subdirectory(libstickynotes)
211 add_subdirectory(kdgantt1)
212 add_subdirectory(icons)
213 add_subdirectory(messagecore)
214 add_subdirectory(messagelist)
217 if (Boost_TOPOLOGICAL_SORT_DIR)
218 macro_optional_add_subdirectory(kleopatra)
219 endif(Boost_TOPOLOGICAL_SORT_DIR)
220 macro_optional_add_subdirectory(wizards)
221 # The following components depend on QGpgME.
222 add_subdirectory(messageviewer)
223 macro_optional_add_subdirectory(messagecomposer)
224 macro_optional_add_subdirectory(kmail)
226 if(KDEPIM_BUILD_EXAMPLES)
227 add_subdirectory(examples)
228 endif(KDEPIM_BUILD_EXAMPLES)
230 # If kmail is compiled, KMAIL_SUPPORTED is true (used in several places)
232 set(KMAIL_SUPPORTED TRUE)
233 add_definitions(-DKMAIL_SUPPORTED)
236 macro_optional_add_subdirectory(kmailcvt)
237 macro_optional_add_subdirectory(ksendemail)
238 macro_optional_add_subdirectory(korganizer)
240 add_subdirectory( nepomuk_email_feeder )
243 if(KDEPIM_BUILD_EVERYTHING)
244 macro_optional_add_subdirectory(knode)
245 endif(KDEPIM_BUILD_EVERYTHING)
247 macro_optional_add_subdirectory(akregator)
248 macro_optional_add_subdirectory(akonadiconsole)
249 macro_optional_add_subdirectory(blogilo)
250 macro_optional_add_subdirectory(console)
251 macro_optional_add_subdirectory(kalarm)
252 macro_optional_add_subdirectory(kjots)
253 macro_optional_add_subdirectory(knotes)
254 macro_optional_add_subdirectory(strigi-analyzer)
256 if(EXISTS ${CMAKE_SOURCE_DIR}/runtime)
257 macro_optional_add_subdirectory(runtime)
258 endif(EXISTS ${CMAKE_SOURCE_DIR}/runtime)
261 include_directories(${CMAKE_SOURCE_DIR}/runtime ${CMAKE_BINARY_DIR}/runtime)
262 endif (BUILD_runtime)
264 macro_optional_add_subdirectory(kaddressbook)
266 macro_optional_add_subdirectory(ktimetracker)
269 macro_optional_add_subdirectory(kontact) # must be the last one.
271 # These targets depend on optional applications
272 add_subdirectory(kresources) # Must be after KAddressbook
273 add_subdirectory(plugins) # Must be after KMail
275 endif (KDEPIM_ONLY_KLEO)
277 # doc must be a subdir of kdepim or packagers will kill us
278 macro_optional_add_subdirectory(doc)
281 # We really want to encourage users to enable/install QGpgME from kdepimlibs
283 # Users must be aware that QGpgMe is really needed
284 message(STATUS "*** WARNING: QGpgME is not installed on your system ***")
285 message(STATUS "*** It is required if you want to use KMail, KOrganizer or Kleopatra ***")
286 message(STATUS "*** You are really encouraged to install it ***")
287 endif(NOT QGPGME_FOUND)
288 # All done, let's display what we found...
289 macro_display_feature_log()