foreach knows how to iterate over map values in a faster an less memory
[kdepim.git] / CMakeLists.txt
blob9f28679fb7e35f35850bb8d89b6d9f39e8104a05
1 project(kdepim)
3 option(KDE4_KDEPIM_NEW_DISTRLISTS "Whether to use new distribution lists, which stores them like normal contacts; useful for Kolab")
4 if(KDE4_KDEPIM_NEW_DISTRLISTS)
5   add_definitions (-DKDEPIM_NEW_DISTRLISTS)
6 endif(KDE4_KDEPIM_NEW_DISTRLISTS)
8 add_definitions ( -DTest1Area=5121 ) # jstaniek
10 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
12 # search packages used by KDE
13 find_package (KDE4 REQUIRED)
14 include(KDE4Defaults)
15 include(MacroLibrary)
16 include(CheckIncludeFiles)
17 find_package(KdepimLibs REQUIRED)
20 if(WIN32)
21   # detect oxygen icon dir at configure time based on KDEDIRS - there may be different package installation locations
22   execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
23   file(TO_CMAKE_PATH "${_dir}" __dir)
24   find_path(KDE4_ICON_DIR oxygen PATHS
25       ${__dir}
26   )
27   message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")
28 else(WIN32)
29     set (KDE4_ICON_DIR  ${CMAKE_INSTALL_PREFIX}/share/icons)
30 endif(WIN32)
32 # this macro exists to work around a stupid Mac OS X linker bug
33 # where it can't handle the same library being referenced multiple
34 # times on the linker line
35 macro (KDEPIM4_LINK_UNIQUE_LIBRARIES)
36   set(LINK_ARG_LIST)  
37   foreach(arg ${ARGN})
38     set(LINK_ARG_FOUND FALSE)
39     foreach(existing ${LINK_ARG_LIST})
40       if(${arg} STREQUAL ${existing})
41         set(LINK_ARG_FOUND)
42       endif(${arg} STREQUAL ${existing})
43     endforeach(existing)
45     if(NOT ${LINK_ARG_FOUND})
46       list(APPEND LINK_ARG_LIST ${arg})
47     endif(NOT ${LINK_ARG_FOUND})
48   endforeach(arg)
50   target_link_libraries(${LINK_ARG_LIST})
51 endmacro (KDEPIM4_LINK_UNIQUE_LIBRARIES)
53 find_package(Boost REQUIRED)
54 macro_log_feature(Boost_FOUND "boost" "Boost C++ Libraries" "http://www.boost.org/" TRUE "" "Required by Akonadi and kleopatra")
56 if ( ONLY_KLEO )
57   find_package(QGpgme REQUIRED)
59   add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DHAVE_CONFIG_H=1)
61   include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} )
63   include (kleopatra/ConfigureChecks.cmake)
65   add_subdirectory(libkleo)
67   find_path(TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
68   if(TOPOLOGICAL_SORT_DIR)
69     macro_optional_add_subdirectory(kleopatra)
70   else(TOPOLOGICAL_SORT_DIR)
71     message(STATUS "topological_sort.hpp is necessary to compile kleopatra. Please install package which contains it.")
72   endif(TOPOLOGICAL_SORT_DIR)
74   macro_optional_add_subdirectory(doc)
76 else ( ONLY_KLEO )
77   # regular case, build everything
79   find_package(Akonadi REQUIRED)
81   if ( NOT EXISTS ${CMAKE_SOURCE_DIR}/libkdepim/kdepim_export.h )
82      message ( FATAL_ERROR "libkdepim directory not found" ) # needed for Kode to compile correctly
83   endif ( NOT EXISTS ${CMAKE_SOURCE_DIR}/libkdepim/kdepim_export.h )
84   find_package(Kode REQUIRED)
85   find_package(ZLIB REQUIRED)
86   find_package(Strigi REQUIRED)
87   find_package(QGpgme)
89   if(Q_WS_X11)
90     macro_log_feature(X11_Xscreensaver_LIB "libXss" "X Window Screen Saver Development Library" "http://xorg.freedesktop.org" FALSE "" "Required for building the KTimeTracker Program")
91   endif(Q_WS_X11)
93 # uncomment the following block for 4.3 in order to enable kitchensync
94 #  if (NOT WIN32)
95 #     set(OPENSYNC_MIN_VERSION 0.38)
96 #     macro_optional_find_package(OpenSync)
97 #     macro_log_feature(OPENSYNC_FOUND "opensync" "OpenSync Development Libraries" "http://www.opensync.org" FALSE "0.38 or greater" "Needed to provide syncing functionality in KDE PIM applications. Necessary to compile kitchensync.")
98 #     macro_optional_find_package(GLIB2)
99 #     macro_log_feature(GLIB2_FOUND "glib2" "Low-level core library for data structure handling, portability wrappers, etc." "http://www.gtk.org" FALSE "2.x" "Needed to provide synching applications from KDE PIM applications. Necessary to compile kitchensync and other PIM applications.")
100 #  endif (NOT WIN32)
102   macro_optional_find_package(GNOKII)
103   macro_bool_to_01(GNOKII_FOUND HAVE_GNOKII_H)
104   macro_log_feature(GNOKII_FOUND "gnokii" "Gnokii Development Libraries" "http://www.gnokii.org" FALSE "" "Needed to provide the ability to import and export KDE addressbook entries to/from mobile phones that are accessible via gnokii")
106   macro_optional_find_package(Soprano)
107   macro_log_feature(Soprano_FOUND "Soprano" "Semantic Desktop Storing" "" FALSE "" "Soprano is needed for Nepomuk")
109   macro_optional_find_package(Nepomuk)
110   macro_log_feature(Nepomuk_FOUND "Nepomuk" "Nepomuk" "http://www.kde.org" FALSE "" "For adding desktop-wide tagging support to kmail")
112   find_program(XSLTPROC_EXECUTABLE xsltproc)
113   macro_log_feature(XSLTPROC_EXECUTABLE "xsltproc" "The command line XSLT processor from libxslt" "http://xmlsoft.org/XSLT/" FALSE "" "Needed for building Akonadi resources. Recommended.")
115   add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
117   include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIR} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/libkdepim/)
119   include (kleopatra/ConfigureChecks.cmake)
121   set(libknotesresources_SRCS
122      ${CMAKE_SOURCE_DIR}/knotes/resourcemanager.cpp
123      ${CMAKE_SOURCE_DIR}/knotes/resourcenotes.cpp
124      ${CMAKE_SOURCE_DIR}/knotes/resourcelocal.cpp
125      ${CMAKE_SOURCE_DIR}/knotes/resourcelocalconfig.cpp
126   )
128   set(libknoteseditor_SRCS
129     ${CMAKE_SOURCE_DIR}/knotes/knoteedit.cpp
130   )
132   set(libkdgantt1_SRCS
133      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttView.cpp
134      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewEventItem.cpp
135      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewItem.cpp
136      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewItemDrag.cpp
137      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewSubwidgets.cpp
138      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewSummaryItem.cpp
139      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewTaskItem.cpp
140      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewTaskLink.cpp
141      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttViewTaskLinkGroup.cpp
142      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttMinimizeSplitter.cpp
143      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttSemiSizingControl.cpp
144      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttSizingControl.cpp
145      ${CMAKE_SOURCE_DIR}/kdgantt1/KDGanttXMLTools.cpp
146   )
148   macro_optional_add_subdirectory(doc)
149   add_subdirectory(kode)
150   macro_optional_add_subdirectory(akonadi)
151   add_subdirectory(libkdepim)
152   add_subdirectory(libkholidays)
153   add_subdirectory(kontactinterfaces)
155   find_path(TOPOLOGICAL_SORT_DIR NAMES boost/graph/topological_sort.hpp PATHS ${Boost_INCLUDE_DIRS})
156   if(QGPGME_FOUND)
157      if(TOPOLOGICAL_SORT_DIR)
158         macro_optional_add_subdirectory(kleopatra)
159      else(TOPOLOGICAL_SORT_DIR)
160         message(STATUS "topological_sort.hpp is necessary to compile kleopatra. Please install package which contains it.")
161      endif(TOPOLOGICAL_SORT_DIR)
162      add_subdirectory(libkleo)
163   endif(QGPGME_FOUND)
165   add_subdirectory(libkpgp)
166   add_subdirectory(libksieve)
167   add_subdirectory(mimelib)
168   add_subdirectory(icons)
169   macro_optional_add_subdirectory(akregator)
170   macro_optional_add_subdirectory(knode)
171   macro_optional_add_subdirectory(kjots)
173   if(QGPGME_FOUND)
174     set(KMAIL_SUPPORTED TRUE)
175     add_definitions(-DKMAIL_SUPPORTED)
176     message(STATUS "KMail support enabled.")
177     macro_optional_add_subdirectory(kmail)
178   else(QGPGME_FOUND)
179     set(KMAIL_SUPPORTED FALSE)
180     message(STATUS "KMail support DISABLED (QGPGME not found).")
181   endif(QGPGME_FOUND)
183   macro_optional_add_subdirectory(kalarm)
184   macro_optional_add_subdirectory(kaddressbook)
186   if(Q_WS_X11)
187     set(KTIMETRACKER_SUPPORTED TRUE)
188     add_definitions(-DKTIMETRACKER_SUPPORTED)
189     message(STATUS "KTimeTracker support enabled.")
190     macro_optional_add_subdirectory(ktimetracker)
191   else(Q_WS_X11)
192     set(KTIMETRACKER_SUPPORTED FALSE)
193     message(STATUS "KTimeTracker support DISABLED (non-X11 target).")
194   endif (Q_WS_X11)
196   add_subdirectory(kdgantt1)
198   macro_optional_add_subdirectory(strigi-analyzer)
200   if(QGPGME_FOUND AND KMAIL_SUPPORTED)
201      macro_optional_add_subdirectory(kmailcvt)
202      message(STATUS "KMailCVT support enabled.")
203   else(QGPGME_FOUND AND KMAIL_SUPPORTED)
204      message(STATUS "KMailCVT support DISABLED (because KMail support is disabled).")
205   endif(QGPGME_FOUND AND KMAIL_SUPPORTED)
206   macro_optional_add_subdirectory(knotes)
207   macro_optional_add_subdirectory(console)
209   if(QGPGME_FOUND AND KMAIL_SUPPORTED)
210      macro_optional_add_subdirectory(korganizer)
211      message(STATUS "KOrganizer support enabled.")
212   else(QGPGME_FOUND AND KMAIL_SUPPORTED)
213      message(STATUS "KOrganizer support DISABLED (because KMail support is disabled).")
214   endif(QGPGME_FOUND AND KMAIL_SUPPORTED)
216   if(KMAIL_SUPPORTED)
217      macro_optional_add_subdirectory(ksendemail)
218      message(STATUS "KSendEmail support enabled.")
219   else(KMAIL_SUPPORTED)
220      message(STATUS "KSendEmail support DISABLED (because KMail support is disabled).")
221   endif(KMAIL_SUPPORTED)
223   if(NOT WIN32)
224 #enable kmobiletools 4.3 if there is interest
225 #     set(KMOBILETOOLS_SUPPORTED TRUE)
226 #     add_definitions(-DKMOBILETOOLS_SUPPORTED)
227 #     message(STATUS "KMobileTools support enabled.")
228 #     macro_optional_add_subdirectory(kmobiletools)
229       set(KMOBILETOOLS_SUPPORTED FALSE)
231      set(KPILOT_SUPPORTED TRUE)
232      add_definitions(-DKPILOT_SUPPORTED)
233      message(STATUS "KPilot support enabled.")
234      macro_optional_add_subdirectory(kpilot)
236      if(OPENSYNC_FOUND AND GLIB2_FOUND)
237        set(KITCHENSYNC_SUPPORTED TRUE)
238        add_definitions(-DKITCHENSYNC_SUPPORTED)
239        message(STATUS "KitchenSync support enabled.")
240        macro_optional_add_subdirectory(kitchensync)
241      else(OPENSYNC_FOUND AND GLIB2_FOUND)
242        set(KITCHENSYNC_SUPPORTED FALSE)
243        if(NOT OPENSYNC_FOUND)
244          message(STATUS "KitchenSync support disabled (OpenSync not found).")
245        endif(NOT OPENSYNC_FOUND)
246        if(NOT GLIB2_FOUND)
247          message(STATUS "KitchenSync support disabled (GLIB not found).")
248        endif(NOT GLIB2_FOUND)
249      endif(OPENSYNC_FOUND AND GLIB2_FOUND)
250   else(NOT WIN32)
251      set(KMOBILETOOLS_SUPPORTED FALSE)
252      message(STATUS "KMobileTools support DISABLED (Windows target).")
253      set(KPILOT_SUPPORTED FALSE)
254      message(STATUS "KPilot support DISABLED (Windows target).")
255      set(KITCHENSYNC_SUPPORTED FALSE)
256      message(STATUS "KitchenSync support DISABLED (Windows target).")
257   endif(NOT WIN32)
259 #enable korn in 4.3 if there is interest
260 # macro_optional_add_subdirectory(korn)
261   add_subdirectory(kresources)
262   macro_optional_add_subdirectory(kontact)
264   if(QGPGME_FOUND)
265      add_subdirectory(wizards)
266   endif(QGPGME_FOUND)
268   add_subdirectory(cmake)
270   # maildir access library
271   add_subdirectory(maildir)
273   add_subdirectory(plugins)
275 endif( ONLY_KLEO )
277 macro_display_feature_log()