Post-release version bump
[evolution.git] / CMakeLists.txt
blobd19c72b36302c2d3319c21a54e76f3f6a0bf6ce7
1 # Evolution build script
3 cmake_minimum_required(VERSION 3.1)
4 cmake_policy(VERSION 3.1)
6 project(evolution
7         VERSION 3.27.3
8         LANGUAGES C)
9 set(PROJECT_BUGREPORT "http://bugzilla.gnome.org/enter_bug.cgi?product=Evolution")
10 set(PROJECT_URL "http://wiki.gnome.org/Apps/Evolution/")
12 # Base Version: This is for API/version tracking for things like
13 # D-Bus server files. This should always be the major/minor of
14 # the stable version or stable version to be.
15 set(BASE_VERSION 3.28)
17 # Used for pkg-config files
18 set(INTERFACE_VERSION 3.0)
20 math(EXPR _is_devel_version "${PROJECT_VERSION_MINOR}%2")
21 if(_is_devel_version EQUAL 1)
22         math(EXPR _minor "${PROJECT_VERSION_MINOR}-1")
23         if(_minor EQUAL -1)
24                 set(_minor 98)
25                 math(EXPR _major "${PROJECT_VERSION_MAJOR}-1")
26         else(_minor EQUAL -1)
27                 set(_major ${PROJECT_VERSION_MAJOR})
28         endif(_minor EQUAL -1)
30         set(STABLE_VERSION "${_major}.${_minor}")
31 else(_is_devel_version EQUAL 1)
32         unset(STABLE_VERSION)
33 endif(_is_devel_version EQUAL 1)
35 # Required for FindIntltool module
36 set(GETTEXT_PACKAGE ${PROJECT_NAME})
37 set(GETTEXT_PO_DIR ${CMAKE_SOURCE_DIR}/po)
39 # Required for 'disttest' and 'ditcheck' of DistTarget module
40 set(PROJECT_DISTCONFIGURE_PARAMS
41         -DENABLE_GTK_DOC=ON
42         -DENABLE_CONTACT_MAPS=ON
43         -DENABLE_INSTALLED_TESTS=ON
44         -DWITH_HELP=ON
45         -DWITH_GLADE_CATALOG=ON
48 # Keep these two definitions in agreement.
49 set(glib_minimum_version 2.46)
50 set(glib_encoded_version GLIB_VERSION_2_46)
52 # Keep these two definitions in agreement.
53 set(gdk_minimum_version 3.22)
54 set(gdk_encoded_version GDK_VERSION_3_22)
56 # Keep these two definitions in agreement.
57 set(soup_minimum_version 2.42)
58 set(soup_encoded_version SOUP_VERSION_2_42)
60 # Warn about API usage that violates our minimum requirements.
61 add_definitions(-DGLIB_VERSION_MAX_ALLOWED=${glib_encoded_version})
62 add_definitions(-DGDK_VERSION_MAX_ALLOWED=${gdk_encoded_version})
63 add_definitions(-DSOUP_VERSION_MAX_ALLOWED=${soup_encoded_version})
65 # These will suppress warnings about newly-deprecated symbols. Ideally
66 # these settings should match our minimum requirements and we will clean
67 # up any new deprecation warnings after bumping our minimum requirements.
68 # But if the warnings get to be overwhelming, use fixed versions instead.
69 add_definitions(-DGLIB_VERSION_MIN_REQUIRED=${glib_encoded_version})
70 add_definitions(-DGDK_VERSION_MIN_REQUIRED=${gdk_encoded_version})
71 add_definitions(-DSOUP_VERSION_MIN_REQUIRED=${soup_encoded_version})
73 set(eds_minimum_version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
74 set(enchant_minimum_version 1.6.0)
75 set(gcr_minimum_version 3.4)
76 set(gdk_pixbuf_minimum_version 2.24.0)
77 set(gnome_desktop_minimum_version 2.91.3)
78 set(gsettings_desktop_schemas_minimum_version 2.91.92)
79 set(libpst_minimum_version 0.6.54)
80 set(libxml_minimum_version 2.7.3)
81 set(shared_mime_info_minimum_version 0.22)
82 set(webkit2gtk_minimum_version 2.16.0)
84 # Optional Packages
85 set(champlain_minimum_version 0.12)
86 set(clutter_gtk_minimum_version 0.90)
87 set(geocode_glib_minimum_version 3.10)
88 set(gladeui_minimum_version 3.10.0)
89 set(gnome_autoar_minimum_version 0.1.1)
90 set(gweather_minimum_version 3.10)
91 set(libcanberra_gtk_minimum_version 0.25)
92 set(libnotify_minimum_version 0.7)
94 # Load modules from the source tree
95 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
97 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
98 # Packagers might want to need different settings for the RPATH related things
99 # From experience, especially CMAKE_BUILD_WITH_INSTALL_RPATH might need to be
100 # switched to ON, if CMake fails to set the right values during make install
101 set(CMAKE_SKIP_RPATH OFF CACHE BOOL INTERNAL)
102 set(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL INTERNAL)
103 set(CMAKE_BUILD_WITH_INSTALL_RPATH OFF CACHE BOOL INTERNAL)
104 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON CACHE BOOL INTERNAL)
105 # CMAKE_INSTALL_RPATH is set below
107 # CMake modules
108 include(CheckCCompilerFlag)
109 include(CheckCSourceCompiles)
110 include(CheckCSourceRuns)
111 include(CheckFunctionExists)
112 include(CheckIncludeFile)
113 include(CheckLibraryExists)
115 # Project custom modules
116 include(PrintableOptions)
118 add_printable_variable(LIB_SUFFIX "Library directory suffix, usually defined to '64' for x86_64 systems" "")
119 add_printable_variable_bare(CMAKE_INSTALL_PREFIX)
120 add_printable_variable_path(BIN_INSTALL_DIR "Install directory for binary files, defaults to CMAKE_INSTALL_PREFIX/bin" "")
121 add_printable_variable_path(INCLUDE_INSTALL_DIR "Install directory for header files, defaults to CMAKE_INSTALL_PREFIX/include" "")
122 add_printable_variable_path(LIB_INSTALL_DIR "Install directory for library files, defaults to CMAKE_INSTALL_PREFIX/lib{LIB_SUFFIX}" "")
123 add_printable_variable_path(LIBEXEC_INSTALL_DIR "Install directory for library executable files, defaults to CMAKE_INSTALL_PREFIX/libexec" "")
124 add_printable_variable_path(SHARE_INSTALL_PREFIX "Install directory for shared files, defaults to CMAKE_INSTALL_PREFIX/share" "")
125 add_printable_variable_path(LOCALE_INSTALL_DIR "Install directory for locale files, defaults to SHARE_INSTALL_PREFIX/locale" "")
126 add_printable_variable_path(SYSCONF_INSTALL_DIR "Install directory for system configuration files, defaults to CMAKE_INSTALL_PREFIX/etc" "")
128 macro(ensure_default_value _var _defvalue)
129         if(${_var} STREQUAL "")
130                 set(${_var} ${_defvalue})
131         endif(${_var} STREQUAL "")
132 endmacro(ensure_default_value)
134 ensure_default_value(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
135 ensure_default_value(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include")
136 ensure_default_value(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
137 ensure_default_value(LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/libexec")
138 ensure_default_value(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share")
139 ensure_default_value(LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale")
140 ensure_default_value(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc")
142 # ******************************
143 # Special directories
144 # ******************************
146 # If you add something here, consider whether or not you also
147 # need to add it to one or more .pc.in files (for Connector, etc)
149 set(privdatadir "${SHARE_INSTALL_PREFIX}/${PROJECT_NAME}")
150 set(privincludedir "${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}")
151 set(privlibdir "${LIB_INSTALL_DIR}/${PROJECT_NAME}")
152 set(privlibexecdir "${LIBEXEC_INSTALL_DIR}/${PROJECT_NAME}")
154 SET(CMAKE_INSTALL_RPATH "${privlibdir}")
156 if(WIN32)
157         # On Win32 there is no "rpath" mechanism. We install the private
158         # shared libraries in $libdir, meaning the DLLs will actually be in
159         # $bindir. This means just having $bindir in PATH will be enough.
160         set(privsolibdir "${LIB_INSTALL_DIR}")
161 else(WIN32)
162         set(privsolibdir "${privlibdir}")
163 endif(WIN32)
165 set(errordir "${privdatadir}/errors")
166 set(etspecdir "${privdatadir}/etspec")
167 set(evolutionhelpdir "${privdatadir}/help")
168 set(icondir "${privdatadir}/icons")
169 set(imagesdir "${privdatadir}/images")
170 set(moduledir "${privlibdir}/modules")
171 set(plugindir "${privlibdir}/plugins")
172 set(soundsdir "${privdatadir}/sounds")
173 set(uidir "${privdatadir}/ui")
174 set(viewsdir "${privdatadir}/views")
175 set(webextensionsdir "${privlibdir}/web-extensions")
176 set(webextensionswebkiteditordir "${webextensionsdir}/webkit-editor")
178 # ******************************
179 # Dependencies
180 # ******************************
182 include(CodeCoverageGCOV)
183 include(CheckTarget)
184 include(DistTargets)
185 include(EvolutionMacros)
186 include(GLibTools)
187 include(GtkDoc)
188 include(IconCache)
189 include(InstalledTests)
190 include(PkgConfigEx)
191 include(SetupBuildFlags)
192 include(UninstallTarget)
194 include(FindIntltool)
195 include(FindLDAP)
196 include(FindSMIME)
198 add_printable_option(ENABLE_MAINTAINER_MODE "Enable maintainer mode" OFF)
199 add_printable_variable(VERSION_SUBSTRING "Version substring, for packagers" "")
200 add_printable_variable(VERSION_COMMENT "Define if you want a comment appended to the version number" "")
202 if(ENABLE_MAINTAINER_MODE)
203         set(BUILD_TESTING ON)
204 endif(ENABLE_MAINTAINER_MODE)
206 # Setup compiler/linker flags
207 setup_build_flags(${ENABLE_MAINTAINER_MODE})
209 set(MATH_LDFLAGS -lm)
211 CHECK_INCLUDE_FILE(sys/wait.h HAVE_SYS_WAIT_H)
212 CHECK_INCLUDE_FILE(X11/XF86keysym.h HAVE_XFREE)
213 CHECK_FUNCTION_EXISTS(mkdtemp HAVE_MKDTEMP)
214 CHECK_FUNCTION_EXISTS(nl_langinfo HAVE_NL_LANGINFO)
216 # ******************************
217 # executables
218 # ******************************
220 find_program(KILL_PROCESS_COMMAND killall)
221 if(NOT KILL_PROCESS_COMMAND)
222         find_program(KILL_PROCESS_COMMAND pkill)
223         set(KILL_PROCESS_COMMAND_ARGS "-f")
224         set(KILL_PROCESS_COMMAND_ARG_EXACT "-x")
225 else(NOT KILL_PROCESS_COMMAND)
226         set(KILL_PROCESS_COMMAND_ARGS "")
227         set(KILL_PROCESS_COMMAND_ARG_EXACT "-e")
228 endif(NOT KILL_PROCESS_COMMAND)
230 if(NOT KILL_PROCESS_COMMAND)
231         message(WARNING "Could not find a command to kill a process by name")
232 endif(NOT KILL_PROCESS_COMMAND)
234 # ******************************
235 # Check for nl_langinfo features
236 # ******************************
238 CHECK_C_SOURCE_COMPILES("#include <langinfo.h>
239                         int main(void) { char *detail = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT); return 0; }" HAVE__NL_MEASUREMENT_MEASUREMENT)
241 # ******************************
242 # Dependencies
243 # ******************************
245 if(WIN32)
246         set(GIO_UNIX_REQUIREMENT "gio-windows-2.0")
247 else(WIN32)
248         set(GIO_UNIX_REQUIREMENT "gio-unix-2.0")
249 endif(WIN32)
251 add_printable_option(ENABLE_GNOME_DESKTOP "Enable GNOME desktop dependency for thumbnails" ON)
253 if(ENABLE_GNOME_DESKTOP)
254         set(GNOME_DESKTOP_DEPENDENCY "gnome-desktop-3.0")
255         set(HAVE_GNOME_DESKTOP ON)
257         # It's checked for it twice, this one gives a hint to disable the dependency if not found
258         pkg_check_modules_for_option(ENABLE_GNOME_DESKTOP "GNOME desktop dependency for thumbnails" GNOME_DESKTOP ${GNOME_DESKTOP_DEPENDENCY}>=${gnome_desktop_minimum_version})
259 else(ENABLE_GNOME_DESKTOP)
260         set(GNOME_DESKTOP_DEPENDENCY "")
261         set(HAVE_GNOME_DESKTOP OFF)
262 endif(ENABLE_GNOME_DESKTOP)
264 pkg_check_modules(GNOME_PLATFORM REQUIRED
265         cairo-gobject
266         gail-3.0>=${gdk_minimum_version}
267         gcr-3>=${gcr_minimum_version}
268         gdk-pixbuf-2.0>=${gdk_pixbuf_minimum_version}
269         gio-2.0>=${glib_minimum_version}
270         ${GIO_UNIX_REQUIREMENT}
271         gmodule-2.0>=${glib_minimum_version}
272         ${GNOME_DESKTOP_DEPENDENCY}
273         gsettings-desktop-schemas>=${gsettings_desktop_schemas_minimum_version}
274         gtk+-3.0>=${gdk_minimum_version}
275         libxml-2.0>=${libxml_minimum_version}
276         shared-mime-info>=${shared_mime_info_minimum_version}
277         webkit2gtk-4.0>=${webkit2gtk_minimum_version}
280 pkg_check_modules(EVOLUTION_DATA_SERVER REQUIRED
281         camel-1.2>=${eds_minimum_version}
282         libebook-1.2>=${eds_minimum_version}
283         libecal-1.2>=${eds_minimum_version}
284         libedataserver-1.2>=${eds_minimum_version}
285         libedataserverui-1.2>=${eds_minimum_version}
286         libebackend-1.2>=${eds_minimum_version}
289 pkg_check_modules(A11Y REQUIRED atk)
290 pkg_check_modules(ENCHANT REQUIRED enchant>=${enchant_minimum_version})
291 pkg_check_modules(LIBSOUP REQUIRED libsoup-2.4>=${soup_minimum_version})
292 pkg_check_modules(WEB_EXTENSION REQUIRED webkit2gtk-4.0>=${webkit2gtk_minimum_version})
294 # ******************************
295 # Canberra / Canberra-GTK Sound
296 # ******************************
298 add_printable_option(ENABLE_CANBERRA "Enable Canberra and Canberra-GTK sound" ON)
300 if(ENABLE_CANBERRA)
301         pkg_check_modules_for_option(ENABLE_CANBERRA "Canberra and Canberra-GTK sound" CANBERRA libcanberra-gtk3>=${libcanberra_gtk_minimum_version})
302         set(HAVE_CANBERRA ON)
303 endif(ENABLE_CANBERRA)
305 # ******************************
306 # Archives Integration / gnome-autoar
307 # ******************************
309 add_printable_option(ENABLE_AUTOAR "Enable archives support in attachments" ON)
311 if(ENABLE_AUTOAR)
312         pkg_check_modules_for_option(ENABLE_AUTOAR "archives support in attachments" AUTOAR
313                 gnome-autoar-0>=${gnome_autoar_minimum_version}
314                 gnome-autoar-gtk-0>=${gnome_autoar_minimum_version}
315         )
316         set(HAVE_AUTOAR ON)
317 endif(ENABLE_AUTOAR)
319 # ******************************
320 # User Documentation
321 # ******************************
323 add_printable_option(WITH_HELP "Build user documentation" ON)
325 if(WITH_HELP)
326         find_program(ITSTOOL itstool)
327         if(NOT ITSTOOL)
328                 message(FATAL_ERROR "Cannot find itstool, either install it or disable help build by adding -DWITH_HELP=OFF argument to cmake command")
329         endif(NOT ITSTOOL)
330 endif(WITH_HELP)
332 # ******************************
333 # iconv checking
334 # ******************************
336 set(CMAKE_REQUIRED_LIBRARIES "-liconv")
337 CHECK_C_SOURCE_COMPILES("#include <iconv.h>
338                         #include <stdlib.h>
339                         int main(void) { iconv_t cd; cd = iconv_open (\"UTF-8\", \"ISO-8859-1\"); return 0; }" HAVE_LIBICONV)
340 unset(CMAKE_REQUIRED_LIBRARIES)
342 if(HAVE_LIBICONV)
343         set(ICONV_LIBS "-liconv")
344         set(HAVE_ICONV ON)
345 else(HAVE_LIBICONV)
346         set(ICONV_LIBS "")
347         CHECK_FUNCTION_EXISTS(iconv HAVE_ICONV)
348 endif(HAVE_LIBICONV)
350 if(NOT HAVE_ICONV)
351         message(FATAL_ERROR "You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv")
352 endif(NOT HAVE_ICONV)
354 set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBS})
355 CHECK_C_SOURCE_RUNS("#include \"${CMAKE_SOURCE_DIR}/iconv-detect.c\"" _correct_iconv)
356 unset(CMAKE_REQUIRED_LIBRARIES)
358 if(NOT _correct_iconv)
359         message(FATAL_ERROR "You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv")
360 endif(NOT _correct_iconv)
362 # ******************************
363 # Timezone checks
364 # ******************************
366 CHECK_C_SOURCE_COMPILES("#include <time.h>
367                         int main(void) { struct tm tm; tm.tm_gmtoff = 1; return 0; }" HAVE_TM_GMTOFF)
369 CHECK_C_SOURCE_COMPILES("#include <time.h>
370                         int main(void) { timezone = 1; return 0; }" HAVE_TIMEZONE)
372 CHECK_C_SOURCE_COMPILES("#include <time.h>
373                         int main(void) { altzone = 1; return 0; }" HAVE_ALTZONE)
375 if((NOT HAVE_TM_GMTOFF) AND (NOT HAVE_TIMEZONE))
376         message(FATAL_ERROR "Unable to find a way to determine timezone")
377 endif((NOT HAVE_TM_GMTOFF) AND (NOT HAVE_TIMEZONE))
379 # ******************************
380 # iso-codes
381 # ******************************
383 pkg_check_exists(HAVE_ISO_CODES iso-codes)
384 if(HAVE_ISO_CODES)
385         pkg_check_at_least_version(HAVE_ISO_CODES iso-codes 0.49)
386         if(HAVE_ISO_CODES)
387                 pkg_check_variable(_iso_codes_domains iso-codes domains)
388                 if(NOT ((_iso_codes_domains MATCHES "639") AND (_iso_codes_domains MATCHES "3166")))
389                         message(WARNING "iso-codes detected, but either iso-639 or iso-3166 domains not found in '${_iso_codes_domains}'")
390                         set(HAVE_ISO_CODES OFF)
391                 else()
392                         pkg_check_variable(ISO_CODES_PREFIX iso-codes prefix)
393                 endif()
394         else(HAVE_ISO_CODES)
395                 set(HAVE_ISO_CODES OFF)
396                 message(WARNING "iso-codes detected, but version 0.49 or later is required due to licensing")
397         endif(HAVE_ISO_CODES)
398 endif(HAVE_ISO_CODES)
400 # ******************************
401 # libcryptui, aka Seahorse
402 # ******************************
404 add_printable_option(ENABLE_LIBCRYPTUI "Enable libcryptui usage" ON)
406 if(ENABLE_LIBCRYPTUI)
407         pkg_check_modules_for_option(ENABLE_LIBCRYPTUI "libcryptui usage" LIBCRYPTUI cryptui-0.0)
408         set(HAVE_LIBCRYPTUI ON)
409 endif(ENABLE_LIBCRYPTUI)
411 # ******************************
412 # TNEF implementation
413 # ******************************
415 add_printable_option(ENABLE_YTNEF "Enable yTNEF library usage" ON)
417 if(ENABLE_YTNEF)
418         set(TNEF_LDFLAGS -lytnef)
420         set(CMAKE_REQUIRED_LIBRARIES ${TNEF_LDFLAGS})
421         CHECK_C_SOURCE_COMPILES("#include <stdio.h>
422                                 #include <ytnef.h>
423                                 int main(void) { TNEFStruct *tnef; return 0; }" HAVE_YTNEF_H)
425         if(NOT HAVE_YTNEF_H)
426                 CHECK_C_SOURCE_COMPILES("#include <stdio.h>
427                                         #include <libytnef/ytnef.h>
428                                         int main(void) { TNEFStruct *tnef; return 0; }" HAVE_LIBYTNEF_YTNEF_H)
429         endif(NOT HAVE_YTNEF_H)
430         unset(CMAKE_REQUIRED_LIBRARIES)
432         if((NOT HAVE_YTNEF_H) AND (NOT HAVE_LIBYTNEF_YTNEF_H))
433                 message(FATAL_ERROR "Cannot find ytnef library, either install it or disable use of it by adding -DENABLE_YTNEF=OFF argument to cmake command")
434         endif((NOT HAVE_YTNEF_H) AND (NOT HAVE_LIBYTNEF_YTNEF_H))
435 endif(ENABLE_YTNEF)
437 # ******************************
438 # Bogofilter (spam filter)
439 # ******************************
441 add_printable_variable_path(WITH_BOGOFILTER "Enable spam filtering using Bogofilter (defaults to /usr/bin/bogofilter)" ON)
443 string(LENGTH "${CMAKE_BINARY_DIR}" bindirlen)
444 string(LENGTH "${WITH_BOGOFILTER}" maxlen)
445 if(maxlen LESS bindirlen)
446         set(substr "***")
447 else(maxlen LESS bindirlen)
448         string(SUBSTRING "${WITH_BOGOFILTER}" 0 ${bindirlen} substr)
449 endif(maxlen LESS bindirlen)
450 string(TOUPPER "${WITH_BOGOFILTER}" optupper)
452 set(BOGOFILTER_COMMAND "")
453 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
454         set(WITH_BOGOFILTER ON)
455 elseif(("${optupper}" STREQUAL "OFF") OR ("${optupper}" STREQUAL "NO"))
456         set(WITH_BOGOFILTER OFF)
457 else()
458         set(BOGOFILTER_COMMAND "${WITH_BOGOFILTER}")
459         set(WITH_BOGOFILTER ON)
460 endif()
462 if(WITH_BOGOFILTER)
463         if(BOGOFILTER_COMMAND STREQUAL "")
464                 set(BOGOFILTER_COMMAND "$ENV{BOGOFILTER}")
465         endif(BOGOFILTER_COMMAND STREQUAL "")
466         if(BOGOFILTER_COMMAND STREQUAL "")
467                 set(BOGOFILTER_COMMAND "/usr/bin/bogofilter")
468         endif(BOGOFILTER_COMMAND STREQUAL "")
469 endif(WITH_BOGOFILTER)
471 unset(bindirlen)
472 unset(maxlen)
473 unset(substr)
474 unset(optupper)
476 # ******************************
477 # SpamAssassin (spam filter)
478 # ******************************
480 add_printable_variable_path(WITH_SPAMASSASSIN "Enable spam filtering using SpamAssassin (defaults to /usr/bin/spamassassin)" ON)
481 add_printable_variable_path(WITH_SA_LEARN "Full path command where sa-learn is located (defaults to /usr/bin/sa-learn)" ON)
483 string(LENGTH "${CMAKE_BINARY_DIR}" bindirlen)
484 string(LENGTH "${WITH_SPAMASSASSIN}" maxlen)
485 if(maxlen LESS bindirlen)
486         set(substr "***")
487 else(maxlen LESS bindirlen)
488         string(SUBSTRING "${WITH_SPAMASSASSIN}" 0 ${bindirlen} substr)
489 endif(maxlen LESS bindirlen)
490 string(TOUPPER "${WITH_SPAMASSASSIN}" optupper)
492 set(SPAMASSASSIN_COMMAND "")
493 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
494         set(WITH_SPAMASSASSIN ON)
495 elseif(("${optupper}" STREQUAL "OFF") OR ("${optupper}" STREQUAL "NO"))
496         set(WITH_SPAMASSASSIN OFF)
497 else()
498         set(SPAMASSASSIN_COMMAND "${WITH_SPAMASSASSIN}")
499         set(WITH_SPAMASSASSIN ON)
500 endif()
502 if(WITH_SPAMASSASSIN)
503         if(SPAMASSASSIN_COMMAND STREQUAL "")
504                 set(SPAMASSASSIN_COMMAND "$ENV{SPAMASSASSIN}")
505         endif(SPAMASSASSIN_COMMAND STREQUAL "")
506         if(SPAMASSASSIN_COMMAND STREQUAL "")
507                 set(SPAMASSASSIN_COMMAND "/usr/bin/spamassassin")
508         endif(SPAMASSASSIN_COMMAND STREQUAL "")
510         string(LENGTH "${WITH_SA_LEARN}" maxlen)
511         if(maxlen LESS bindirlen)
512                 set(substr "***")
513         else(maxlen LESS bindirlen)
514                 string(SUBSTRING "${WITH_SA_LEARN}" 0 ${bindirlen} substr)
515         endif(maxlen LESS bindirlen)
516         string(TOUPPER "${WITH_SA_LEARN}" optupper)
518         set(SA_LEARN_COMMAND "")
519         if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
520                 set(WITH_SA_LEARN ON)
521         elseif(("${optupper}" STREQUAL "OFF") OR ("${optupper}" STREQUAL "NO"))
522                 set(WITH_SA_LEARN OFF)
523         else()
524                 set(SA_LEARN_COMMAND "${WITH_SA_LEARN}")
525                 set(WITH_SA_LEARN ON)
526         endif()
528         if(SA_LEARN_COMMAND STREQUAL "")
529                 set(SA_LEARN_COMMAND "$ENV{SA_LEARN}")
530         endif(SA_LEARN_COMMAND STREQUAL "")
531         if(SA_LEARN_COMMAND STREQUAL "")
532                 set(SA_LEARN_COMMAND "/usr/bin/sa-learn")
533         endif(SA_LEARN_COMMAND STREQUAL "")
534 endif(WITH_SPAMASSASSIN)
536 unset(bindirlen)
537 unset(maxlen)
538 unset(substr)
539 unset(optupper)
541 # ******************************
542 # CERT_UI Flags
543 # ******************************
545 # Here we want the Mozilla flags to go *before* the other ones,
546 # especially the mozilla-nss -I flags to go before the gnutls ones,
547 # as both gnutls and mozilla-nss have a header called "pkcs12.h" which is
548 # included in smime/lib/e-pkcs12.c. It wants the Mozilla NSS one.
550 set(CERT_UI_INCLUDES ${MANUAL_NSPR_INCLUDES})
551 set(CERT_UI_LIBS ${MANUAL_NSPR_LIBS})
553 # ******************************
554 # Libnotify
555 # ******************************
557 pkg_check_modules(LIBNOTIFY libnotify>=${libnotify_minimum_version})
558 set(HAVE_LIBNOTIFY ${LIBNOTIFY_FOUND})
560 # ******************************
561 # libical tweaks
562 # ******************************
564 set(CMAKE_REQUIRED_DEFINITIONS ${EVOLUTION_DATA_SERVER_CFLAGS_OTHER})
565 set(CMAKE_REQUIRED_INCLUDES ${EVOLUTION_DATA_SERVER_INCLUDE_DIRS})
566 set(CMAKE_REQUIRED_LIBRARIES ${EVOLUTION_DATA_SERVER_LDFLAGS})
568 CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
569                         int main(void) {
570                                 ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN);
571                                 return 0;
572                         }" HAVE_ICAL_UNKNOWN_TOKEN_HANDLING)
574 CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
575                         int main(void) {
576                                 icaltzutil_set_exact_vtimezones_support (0);
577                                 return 0;
578                         }" HAVE_ICALTZUTIL_SET_EXACT_VTIMEZONES_SUPPORT)
580 CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
581                         int main(void) {
582                                 icalparameter *param;
583                                 param = icalproperty_get_first_parameter (NULL, ICAL_FILENAME_PARAMETER);
584                                 icalparameter_get_filename (param);
585                                 icalparameter_new_filename (NULL);
586                                 return 0;
587                         }" HAVE_ICAL_FILENAME_PARAMETER)
589 unset(CMAKE_REQUIRED_DEFINITIONS)
590 unset(CMAKE_REQUIRED_INCLUDES)
591 unset(CMAKE_REQUIRED_LIBRARIES)
593 # ******************************
594 # gtkspell
595 # ******************************
597 add_printable_option(ENABLE_GTKSPELL "Enable gtkspell usage" ON)
599 if(ENABLE_GTKSPELL)
600         pkg_check_modules_for_option(ENABLE_GTKSPELL "gtkspell usage" GTKSPELL gtkspell3-3.0)
601         set(HAVE_GTKSPELL ON)
602 endif(ENABLE_GTKSPELL)
604 # ******************************
605 # gnu_get_libc_version()
606 # ******************************
608 CHECK_C_SOURCE_COMPILES("#include <gnu/libc-version.h>
609                         int main(void) { const gchar *libc_version = gnu_get_libc_version (); return 0; }" HAVE_GNU_GET_LIBC_VERSION)
611 # ******************************
612 # Plugins
613 # ******************************
615 add_printable_variable(ENABLE_PLUGINS "Enable plugins (no/base/all)" "all")
617 set(plugins_base
618         publish-calendar
620 set(plugins_standard
621         attachment-reminder
622         bbdb
623         dbx-import
624         email-custom-header
625         external-editor
626         face
627         mail-to-task
628         mailing-list-actions
629         mail-notification
630         save-calendar
631         templates
634 # ******************************************************************
635 # The following plugins have additional library dependencies.
636 # They must be explicitly disabled if the libraries are not present.
637 # ******************************************************************
639 # text-highlight
641 add_printable_option(ENABLE_TEXT_HIGHLIGHT "Enable text-highlight plugin" ON)
643 if(ENABLE_TEXT_HIGHLIGHT)
644         find_program(HIGHLIGHT_COMMAND highlight)
646         if(NOT HIGHLIGHT_COMMAND)
647                 message(FATAL_ERROR "The 'highlight' program not found; either give it into PATH or disable higlight plugin with -DENABLE_TEXT_HIGHLIGHT=OFF")
648         endif(NOT HIGHLIGHT_COMMAND)
649 endif(ENABLE_TEXT_HIGHLIGHT)
651 # weather calendar
653 add_printable_option(ENABLE_WEATHER "Enable weather calendars" ON)
655 if(ENABLE_WEATHER)
656         pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar" GWEATHER gweather-3.0>=${gweather_minimum_version})
657 endif(ENABLE_WEATHER)
659 # maps in Contacts preview
661 add_printable_option(ENABLE_CONTACT_MAPS "Enable contact maps" OFF)
663 if(ENABLE_CONTACT_MAPS)
664         pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" CHAMPLAIN champlain-gtk-0.12>=${champlain_minimum_version})
665         pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" GEO geocode-glib-1.0>=${geocode_glib_minimum_version})
666         pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" CLUTTER_GTK clutter-gtk-1.0>=${clutter_gtk_minimum_version})
667 endif(ENABLE_CONTACT_MAPS)
669 # pst-import plugin
671 add_printable_option(ENABLE_PST_IMPORT "Enable pst-import plugin" ON)
673 if(ENABLE_PST_IMPORT)
674         pkg_check_modules_for_option(ENABLE_PST_IMPORT "pst-import plugin" LIBPST libpst>=${libpst_minimum_version})
675         list(APPEND plugins_standard pst-import)
676 endif(ENABLE_PST_IMPORT)
678 # Finish plugins build setup
679 set(build_plugins)
681 if(ENABLE_PLUGINS STREQUAL "" OR ENABLE_PLUGINS STREQUAL "all")
682         set(build_plugins ${plugins_base} ${plugins_standard})
683 elseif(ENABLE_PLUGINS STREQUAL "base")
684         set(build_plugins ${plugins_base})
685 elseif(NOT ENABLE_PLUGINS STREQUAL "no")
686         message(FATAL_ERROR "Incorrect value for ENABLE_PLUGINS (${ENABLE_PLUGINS}), use either \"no\", or \"base\" or \"all\" value")
687 endif()
689 # ******************************
690 # Glade catalog
691 # ******************************
693 add_printable_option(WITH_GLADE_CATALOG "Install the catalog files for Glade 3 (for maintainers only)" OFF)
695 if(WITH_GLADE_CATALOG)
696         pkg_check_modules_for_option(WITH_GLADE_CATALOG "Glade 3 catalog files" GLADEUI gladeui-2.0>=${gladeui_minimum_version})
697 endif(WITH_GLADE_CATALOG)
699 # Generate the ${PROJECT_NAME}-config.h file
700 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config.h)
702 print_build_options()
704 # The shell_private_requirements is used by the evolution-shell.pc.in
705 if(ENABLE_GNOME_DESKTOP)
706         set(shell_private_requirements "Requires.private: ${GNOME_DESKTOP_DEPENDENCY}")
707 else(ENABLE_GNOME_DESKTOP)
708         set(shell_private_requirements "")
709 endif(ENABLE_GNOME_DESKTOP)
711 # The shell_privlibdir_rpath_flags is used by the evolution-shell.pc.in
712 # and if set, then should be preceded with a space.
713 if(NOT WIN32)
714         set(shell_privlibdir_rpath_flags  " -Wl,-R${privlibdir}")
715 endif(NOT WIN32)
717 add_pkgconfig_file(evolution-calendar.pc.in evolution-calendar-${INTERFACE_VERSION}.pc)
718 add_pkgconfig_file(evolution-mail.pc.in evolution-mail-${INTERFACE_VERSION}.pc)
719 add_pkgconfig_file(evolution-shell.pc.in evolution-shell-${INTERFACE_VERSION}.pc)
721 add_subdirectory(data)
722 add_subdirectory(po)
723 add_subdirectory(src)
724 add_subdirectory(tests)
726 if(ENABLE_GTK_DOC)
727         add_subdirectory(docs)
728 endif(ENABLE_GTK_DOC)
730 if(WITH_HELP)
731         add_subdirectory(help)
732 endif(WITH_HELP)