1 # Evolution build script
3 cmake_minimum_required(VERSION 3.1)
4 cmake_policy(VERSION 3.1)
9 set(PROJECT_BUGREPORT "https://gitlab.gnome.org/GNOME/evolution/issues/")
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.30)
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")
25 math(EXPR _major "${PROJECT_VERSION_MAJOR}-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)
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
42 -DENABLE_CONTACT_MAPS=ON
43 -DENABLE_INSTALLED_TESTS=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(enchant1_minimum_version 1.6.0)
75 set(enchant2_minimum_version 2.2.0)
76 set(gcr_minimum_version 3.4)
77 set(gdk_pixbuf_minimum_version 2.24.0)
78 set(gnome_desktop_minimum_version 2.91.3)
79 set(gsettings_desktop_schemas_minimum_version 2.91.92)
80 set(libpst_minimum_version 0.6.54)
81 set(libxml_minimum_version 2.7.3)
82 set(shared_mime_info_minimum_version 0.22)
83 set(webkit2gtk_minimum_version 2.16.0)
86 set(champlain_minimum_version 0.12)
87 set(clutter_gtk_minimum_version 0.90)
88 set(geocode_glib_minimum_version 3.10)
89 set(gladeui_minimum_version 3.10.0)
90 set(gnome_autoar_minimum_version 0.1.1)
91 set(gweather_minimum_version 3.10)
92 set(libcanberra_gtk_minimum_version 0.25)
93 set(libnotify_minimum_version 0.7)
94 set(libunity_minimum_version 7.1.4)
96 # Load modules from the source tree
97 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
99 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
100 # Packagers might want to need different settings for the RPATH related things
101 # From experience, especially CMAKE_BUILD_WITH_INSTALL_RPATH might need to be
102 # switched to ON, if CMake fails to set the right values during make install
103 set(CMAKE_SKIP_RPATH OFF CACHE BOOL INTERNAL)
104 set(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL INTERNAL)
105 set(CMAKE_BUILD_WITH_INSTALL_RPATH OFF CACHE BOOL INTERNAL)
106 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON CACHE BOOL INTERNAL)
107 # CMAKE_INSTALL_RPATH is set below
110 include(CheckCCompilerFlag)
111 include(CheckCSourceCompiles)
112 include(CheckCSourceRuns)
113 include(CheckFunctionExists)
114 include(CheckIncludeFile)
115 include(CheckLibraryExists)
117 # Project custom modules
118 include(PrintableOptions)
120 add_printable_variable(LIB_SUFFIX "Library directory suffix, usually defined to '64' for x86_64 systems" "")
121 add_printable_variable_bare(CMAKE_INSTALL_PREFIX)
122 add_printable_variable_path(BIN_INSTALL_DIR "Install directory for binary files, defaults to CMAKE_INSTALL_PREFIX/bin" "")
123 add_printable_variable_path(INCLUDE_INSTALL_DIR "Install directory for header files, defaults to CMAKE_INSTALL_PREFIX/include" "")
124 add_printable_variable_path(LIB_INSTALL_DIR "Install directory for library files, defaults to CMAKE_INSTALL_PREFIX/lib{LIB_SUFFIX}" "")
125 add_printable_variable_path(LIBEXEC_INSTALL_DIR "Install directory for library executable files, defaults to CMAKE_INSTALL_PREFIX/libexec" "")
126 add_printable_variable_path(SHARE_INSTALL_PREFIX "Install directory for shared files, defaults to CMAKE_INSTALL_PREFIX/share" "")
127 add_printable_variable_path(LOCALE_INSTALL_DIR "Install directory for locale files, defaults to SHARE_INSTALL_PREFIX/locale" "")
128 add_printable_variable_path(SYSCONF_INSTALL_DIR "Install directory for system configuration files, defaults to CMAKE_INSTALL_PREFIX/etc" "")
130 macro(ensure_default_value _var _defvalue)
131 if(${_var} STREQUAL "")
132 set(${_var} ${_defvalue})
133 endif(${_var} STREQUAL "")
134 endmacro(ensure_default_value)
136 ensure_default_value(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
137 ensure_default_value(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include")
138 ensure_default_value(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
139 ensure_default_value(LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/libexec")
140 ensure_default_value(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share")
141 ensure_default_value(LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale")
142 ensure_default_value(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc")
144 # ******************************
145 # Special directories
146 # ******************************
148 # If you add something here, consider whether or not you also
149 # need to add it to one or more .pc.in files (for Connector, etc)
151 set(privdatadir "${SHARE_INSTALL_PREFIX}/${PROJECT_NAME}")
152 set(privincludedir "${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}")
153 set(privlibdir "${LIB_INSTALL_DIR}/${PROJECT_NAME}")
154 set(privlibexecdir "${LIBEXEC_INSTALL_DIR}/${PROJECT_NAME}")
156 SET(CMAKE_INSTALL_RPATH "${privlibdir}")
159 # On Win32 there is no "rpath" mechanism. We install the private
160 # shared libraries in $libdir, meaning the DLLs will actually be in
161 # $bindir. This means just having $bindir in PATH will be enough.
162 set(privsolibdir "${LIB_INSTALL_DIR}")
164 set(privsolibdir "${privlibdir}")
167 set(errordir "${privdatadir}/errors")
168 set(etspecdir "${privdatadir}/etspec")
169 set(evolutionhelpdir "${privdatadir}/help")
170 set(icondir "${privdatadir}/icons")
171 set(imagesdir "${privdatadir}/images")
172 set(moduledir "${privlibdir}/modules")
173 set(plugindir "${privlibdir}/plugins")
174 set(soundsdir "${privdatadir}/sounds")
175 set(uidir "${privdatadir}/ui")
176 set(viewsdir "${privdatadir}/views")
177 set(webextensionsdir "${privlibdir}/web-extensions")
178 set(webextensionswebkiteditordir "${webextensionsdir}/webkit-editor")
180 # ******************************
182 # ******************************
184 include(CodeCoverageGCOV)
187 include(EvolutionMacros)
191 include(InstalledTests)
193 include(SetupBuildFlags)
194 include(UninstallTarget)
196 include(FindIntltool)
200 add_printable_option(ENABLE_MAINTAINER_MODE "Enable maintainer mode" OFF)
201 add_printable_variable(VERSION_SUBSTRING "Version substring, for packagers" "")
202 add_printable_variable(VERSION_COMMENT "Define if you want a comment appended to the version number" "")
204 if(ENABLE_MAINTAINER_MODE)
205 set(BUILD_TESTING ON)
206 endif(ENABLE_MAINTAINER_MODE)
208 # Setup compiler/linker flags
209 setup_build_flags(${ENABLE_MAINTAINER_MODE})
211 set(MATH_LDFLAGS -lm)
213 CHECK_INCLUDE_FILE(sys/wait.h HAVE_SYS_WAIT_H)
214 CHECK_INCLUDE_FILE(X11/XF86keysym.h HAVE_XFREE)
215 CHECK_FUNCTION_EXISTS(mkdtemp HAVE_MKDTEMP)
216 CHECK_FUNCTION_EXISTS(nl_langinfo HAVE_NL_LANGINFO)
218 # ******************************
220 # ******************************
222 find_program(KILL_PROCESS_COMMAND killall)
223 if(NOT KILL_PROCESS_COMMAND)
224 find_program(KILL_PROCESS_COMMAND pkill)
225 set(KILL_PROCESS_COMMAND_ARGS "-f")
226 set(KILL_PROCESS_COMMAND_ARG_EXACT "-x")
227 else(NOT KILL_PROCESS_COMMAND)
228 set(KILL_PROCESS_COMMAND_ARGS "")
229 set(KILL_PROCESS_COMMAND_ARG_EXACT "-e")
230 endif(NOT KILL_PROCESS_COMMAND)
232 if(NOT KILL_PROCESS_COMMAND)
233 message(WARNING "Could not find a command to kill a process by name")
234 endif(NOT KILL_PROCESS_COMMAND)
236 # ******************************
237 # Check for nl_langinfo features
238 # ******************************
240 CHECK_C_SOURCE_COMPILES("#include <langinfo.h>
241 int main(void) { char *detail = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT); return 0; }" HAVE__NL_MEASUREMENT_MEASUREMENT)
243 # ******************************
245 # ******************************
248 set(GIO_UNIX_REQUIREMENT "gio-windows-2.0")
250 set(GIO_UNIX_REQUIREMENT "gio-unix-2.0")
253 add_printable_option(ENABLE_GNOME_DESKTOP "Enable GNOME desktop dependency for thumbnails" ON)
255 if(ENABLE_GNOME_DESKTOP)
256 set(GNOME_DESKTOP_DEPENDENCY "gnome-desktop-3.0")
257 set(HAVE_GNOME_DESKTOP ON)
259 # It's checked for it twice, this one gives a hint to disable the dependency if not found
260 pkg_check_modules_for_option(ENABLE_GNOME_DESKTOP "GNOME desktop dependency for thumbnails" GNOME_DESKTOP ${GNOME_DESKTOP_DEPENDENCY}>=${gnome_desktop_minimum_version})
261 else(ENABLE_GNOME_DESKTOP)
262 set(GNOME_DESKTOP_DEPENDENCY "")
263 set(HAVE_GNOME_DESKTOP OFF)
264 endif(ENABLE_GNOME_DESKTOP)
266 pkg_check_modules(GNOME_PLATFORM REQUIRED
268 gail-3.0>=${gdk_minimum_version}
269 gcr-3>=${gcr_minimum_version}
270 gdk-pixbuf-2.0>=${gdk_pixbuf_minimum_version}
271 gio-2.0>=${glib_minimum_version}
272 ${GIO_UNIX_REQUIREMENT}
273 gmodule-2.0>=${glib_minimum_version}
274 ${GNOME_DESKTOP_DEPENDENCY}
275 gsettings-desktop-schemas>=${gsettings_desktop_schemas_minimum_version}
276 gtk+-3.0>=${gdk_minimum_version}
277 libxml-2.0>=${libxml_minimum_version}
278 shared-mime-info>=${shared_mime_info_minimum_version}
279 webkit2gtk-4.0>=${webkit2gtk_minimum_version}
282 pkg_check_modules(EVOLUTION_DATA_SERVER REQUIRED
283 camel-1.2>=${eds_minimum_version}
284 libebook-1.2>=${eds_minimum_version}
285 libecal-1.2>=${eds_minimum_version}
286 libedataserver-1.2>=${eds_minimum_version}
287 libedataserverui-1.2>=${eds_minimum_version}
288 libebackend-1.2>=${eds_minimum_version}
291 pkg_check_modules(A11Y REQUIRED atk)
292 pkg_check_modules(LIBSOUP REQUIRED libsoup-2.4>=${soup_minimum_version})
293 pkg_check_modules(WEB_EXTENSION REQUIRED webkit2gtk-4.0>=${webkit2gtk_minimum_version})
295 # ******************************
296 # Enchant - support both, but better to use the same as the dependencies (gtkspell3, webkitgtk+,...)
297 # ******************************
299 add_printable_option(WITH_ENCHANT_VERSION "Set Enchant version to use, values are: 'auto' (default), 1 or 2" "auto")
301 if(WITH_ENCHANT_VERSION STREQUAL "1")
302 pkg_check_modules(ENCHANT REQUIRED enchant>=${enchant1_minimum_version})
303 else(WITH_ENCHANT_VERSION STREQUAL "1")
304 if(WITH_ENCHANT_VERSION STREQUAL "2")
305 pkg_check_modules(ENCHANT REQUIRED enchant-2>=${enchant2_minimum_version})
306 else(WITH_ENCHANT_VERSION STREQUAL "2")
307 pkg_check_modules(ENCHANT enchant>=${enchant1_minimum_version})
309 set(WITH_ENCHANT_VERSION "auto (enchant-1)")
312 pkg_check_modules(ENCHANT enchant-2>=${enchant2_minimum_version})
314 set(WITH_ENCHANT_VERSION "auto (enchant-2)")
316 message(FATAL_ERROR "Cannot find enchant 1 neither enchant 2, or new-enough version. Install either of them "
317 "or specify which to use with -DWITH_ENCHANT_VERSION=auto|1|2, where 'auto' is the default")
320 endif(WITH_ENCHANT_VERSION STREQUAL "2")
321 endif(WITH_ENCHANT_VERSION STREQUAL "1")
323 # ******************************
324 # Canberra / Canberra-GTK Sound
325 # ******************************
327 add_printable_option(ENABLE_CANBERRA "Enable Canberra and Canberra-GTK sound" ON)
330 pkg_check_modules_for_option(ENABLE_CANBERRA "Canberra and Canberra-GTK sound" CANBERRA libcanberra-gtk3>=${libcanberra_gtk_minimum_version})
331 set(HAVE_CANBERRA ON)
332 endif(ENABLE_CANBERRA)
334 # ******************************
335 # Archives Integration / gnome-autoar
336 # ******************************
338 add_printable_option(ENABLE_AUTOAR "Enable archives support in attachments" ON)
341 pkg_check_modules_for_option(ENABLE_AUTOAR "archives support in attachments" AUTOAR
342 gnome-autoar-0>=${gnome_autoar_minimum_version}
343 gnome-autoar-gtk-0>=${gnome_autoar_minimum_version}
348 # ******************************
350 # ******************************
352 add_printable_option(WITH_HELP "Build user documentation" ON)
355 find_program(ITSTOOL itstool)
357 message(FATAL_ERROR "Cannot find itstool, either install it or disable help build by adding -DWITH_HELP=OFF argument to cmake command")
361 # ******************************
363 # ******************************
365 set(CMAKE_REQUIRED_LIBRARIES "-liconv")
366 CHECK_C_SOURCE_COMPILES("#include <iconv.h>
368 int main(void) { iconv_t cd; cd = iconv_open (\"UTF-8\", \"ISO-8859-1\"); return 0; }" HAVE_LIBICONV)
369 unset(CMAKE_REQUIRED_LIBRARIES)
372 set(ICONV_LIBS "-liconv")
376 CHECK_FUNCTION_EXISTS(iconv HAVE_ICONV)
380 message(FATAL_ERROR "You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv")
381 endif(NOT HAVE_ICONV)
383 set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBS})
384 file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/" _binary_dir_with_separator)
385 CHECK_C_SOURCE_RUNS("#define ICONV_DETECT_BUILD_DIR \"${_binary_dir_with_separator}\"
386 #include \"${CMAKE_SOURCE_DIR}/iconv-detect.c\"" _correct_iconv)
387 unset(_binary_dir_with_separator)
388 unset(CMAKE_REQUIRED_LIBRARIES)
390 if(NOT _correct_iconv)
391 message(FATAL_ERROR "You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv")
392 endif(NOT _correct_iconv)
394 # ******************************
396 # ******************************
398 CHECK_C_SOURCE_COMPILES("#include <time.h>
399 int main(void) { struct tm tm; tm.tm_gmtoff = 1; return 0; }" HAVE_TM_GMTOFF)
401 CHECK_C_SOURCE_COMPILES("#include <time.h>
402 int main(void) { timezone = 1; return 0; }" HAVE_TIMEZONE)
404 CHECK_C_SOURCE_COMPILES("#include <time.h>
405 int main(void) { altzone = 1; return 0; }" HAVE_ALTZONE)
407 if((NOT HAVE_TM_GMTOFF) AND (NOT HAVE_TIMEZONE))
408 message(FATAL_ERROR "Unable to find a way to determine timezone")
409 endif((NOT HAVE_TM_GMTOFF) AND (NOT HAVE_TIMEZONE))
411 # ******************************
413 # ******************************
415 pkg_check_exists(HAVE_ISO_CODES iso-codes)
417 pkg_check_at_least_version(HAVE_ISO_CODES iso-codes 0.49)
419 pkg_check_variable(_iso_codes_domains iso-codes domains)
420 if(NOT ((_iso_codes_domains MATCHES "639") AND (_iso_codes_domains MATCHES "3166")))
421 message(WARNING "iso-codes detected, but either iso-639 or iso-3166 domains not found in '${_iso_codes_domains}'")
422 set(HAVE_ISO_CODES OFF)
424 pkg_check_variable(ISO_CODES_PREFIX iso-codes prefix)
427 set(HAVE_ISO_CODES OFF)
428 message(WARNING "iso-codes detected, but version 0.49 or later is required due to licensing")
429 endif(HAVE_ISO_CODES)
430 endif(HAVE_ISO_CODES)
432 # ******************************
433 # libcryptui, aka Seahorse
434 # ******************************
436 add_printable_option(ENABLE_LIBCRYPTUI "Enable libcryptui usage" ON)
438 if(ENABLE_LIBCRYPTUI)
439 pkg_check_modules_for_option(ENABLE_LIBCRYPTUI "libcryptui usage" LIBCRYPTUI cryptui-0.0)
440 set(HAVE_LIBCRYPTUI ON)
441 endif(ENABLE_LIBCRYPTUI)
443 # ******************************
444 # TNEF implementation
445 # ******************************
447 add_printable_option(ENABLE_YTNEF "Enable yTNEF library usage" ON)
450 set(TNEF_LDFLAGS -lytnef)
452 set(CMAKE_REQUIRED_LIBRARIES ${TNEF_LDFLAGS})
453 CHECK_C_SOURCE_COMPILES("#include <stdio.h>
455 int main(void) { TNEFStruct *tnef; return 0; }" HAVE_YTNEF_H)
458 CHECK_C_SOURCE_COMPILES("#include <stdio.h>
459 #include <libytnef/ytnef.h>
460 int main(void) { TNEFStruct *tnef; return 0; }" HAVE_LIBYTNEF_YTNEF_H)
461 endif(NOT HAVE_YTNEF_H)
462 unset(CMAKE_REQUIRED_LIBRARIES)
464 if((NOT HAVE_YTNEF_H) AND (NOT HAVE_LIBYTNEF_YTNEF_H))
465 message(FATAL_ERROR "Cannot find ytnef library, either install it or disable use of it by adding -DENABLE_YTNEF=OFF argument to cmake command")
466 endif((NOT HAVE_YTNEF_H) AND (NOT HAVE_LIBYTNEF_YTNEF_H))
469 # ******************************
470 # Bogofilter (spam filter)
471 # ******************************
473 add_printable_variable_path(WITH_BOGOFILTER "Enable spam filtering using Bogofilter (defaults to /usr/bin/bogofilter)" ON)
475 string(LENGTH "${CMAKE_BINARY_DIR}" bindirlen)
476 string(LENGTH "${WITH_BOGOFILTER}" maxlen)
477 if(maxlen LESS bindirlen)
479 else(maxlen LESS bindirlen)
480 string(SUBSTRING "${WITH_BOGOFILTER}" 0 ${bindirlen} substr)
481 endif(maxlen LESS bindirlen)
482 string(TOUPPER "${WITH_BOGOFILTER}" optupper)
484 set(BOGOFILTER_COMMAND "")
485 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
486 set(WITH_BOGOFILTER ON)
487 elseif(("${optupper}" STREQUAL "OFF") OR ("${optupper}" STREQUAL "NO"))
488 set(WITH_BOGOFILTER OFF)
490 set(BOGOFILTER_COMMAND "${WITH_BOGOFILTER}")
491 set(WITH_BOGOFILTER ON)
495 if(BOGOFILTER_COMMAND STREQUAL "")
496 set(BOGOFILTER_COMMAND "$ENV{BOGOFILTER}")
497 endif(BOGOFILTER_COMMAND STREQUAL "")
498 if(BOGOFILTER_COMMAND STREQUAL "")
499 set(BOGOFILTER_COMMAND "/usr/bin/bogofilter")
500 endif(BOGOFILTER_COMMAND STREQUAL "")
501 endif(WITH_BOGOFILTER)
508 # ******************************
509 # SpamAssassin (spam filter)
510 # ******************************
512 add_printable_variable_path(WITH_SPAMASSASSIN "Enable spam filtering using SpamAssassin (defaults to /usr/bin/spamassassin)" ON)
513 add_printable_variable_path(WITH_SA_LEARN "Full path command where sa-learn is located (defaults to /usr/bin/sa-learn)" ON)
515 string(LENGTH "${CMAKE_BINARY_DIR}" bindirlen)
516 string(LENGTH "${WITH_SPAMASSASSIN}" maxlen)
517 if(maxlen LESS bindirlen)
519 else(maxlen LESS bindirlen)
520 string(SUBSTRING "${WITH_SPAMASSASSIN}" 0 ${bindirlen} substr)
521 endif(maxlen LESS bindirlen)
522 string(TOUPPER "${WITH_SPAMASSASSIN}" optupper)
524 set(SPAMASSASSIN_COMMAND "")
525 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
526 set(WITH_SPAMASSASSIN ON)
527 elseif(("${optupper}" STREQUAL "OFF") OR ("${optupper}" STREQUAL "NO"))
528 set(WITH_SPAMASSASSIN OFF)
530 set(SPAMASSASSIN_COMMAND "${WITH_SPAMASSASSIN}")
531 set(WITH_SPAMASSASSIN ON)
534 if(WITH_SPAMASSASSIN)
535 if(SPAMASSASSIN_COMMAND STREQUAL "")
536 set(SPAMASSASSIN_COMMAND "$ENV{SPAMASSASSIN}")
537 endif(SPAMASSASSIN_COMMAND STREQUAL "")
538 if(SPAMASSASSIN_COMMAND STREQUAL "")
539 set(SPAMASSASSIN_COMMAND "/usr/bin/spamassassin")
540 endif(SPAMASSASSIN_COMMAND STREQUAL "")
542 string(LENGTH "${WITH_SA_LEARN}" maxlen)
543 if(maxlen LESS bindirlen)
545 else(maxlen LESS bindirlen)
546 string(SUBSTRING "${WITH_SA_LEARN}" 0 ${bindirlen} substr)
547 endif(maxlen LESS bindirlen)
548 string(TOUPPER "${WITH_SA_LEARN}" optupper)
550 set(SA_LEARN_COMMAND "")
551 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
552 set(WITH_SA_LEARN ON)
553 elseif(("${optupper}" STREQUAL "OFF") OR ("${optupper}" STREQUAL "NO"))
554 set(WITH_SA_LEARN OFF)
556 set(SA_LEARN_COMMAND "${WITH_SA_LEARN}")
557 set(WITH_SA_LEARN ON)
560 if(SA_LEARN_COMMAND STREQUAL "")
561 set(SA_LEARN_COMMAND "$ENV{SA_LEARN}")
562 endif(SA_LEARN_COMMAND STREQUAL "")
563 if(SA_LEARN_COMMAND STREQUAL "")
564 set(SA_LEARN_COMMAND "/usr/bin/sa-learn")
565 endif(SA_LEARN_COMMAND STREQUAL "")
566 endif(WITH_SPAMASSASSIN)
573 # ******************************
575 # ******************************
577 # Here we want the Mozilla flags to go *before* the other ones,
578 # especially the mozilla-nss -I flags to go before the gnutls ones,
579 # as both gnutls and mozilla-nss have a header called "pkcs12.h" which is
580 # included in smime/lib/e-pkcs12.c. It wants the Mozilla NSS one.
582 set(CERT_UI_INCLUDES ${MANUAL_NSPR_INCLUDES})
583 set(CERT_UI_LIBS ${MANUAL_NSPR_LIBS})
585 # ******************************
587 # ******************************
589 pkg_check_modules(LIBNOTIFY libnotify>=${libnotify_minimum_version})
590 set(HAVE_LIBNOTIFY ${LIBNOTIFY_FOUND})
592 # ******************************
594 # ******************************
596 pkg_check_modules(LIBUNITY unity>=${libunity_minimum_version})
597 set(HAVE_LIBUNITY ${LIBUNITY_FOUND})
599 # ******************************
601 # ******************************
603 set(CMAKE_REQUIRED_DEFINITIONS ${EVOLUTION_DATA_SERVER_CFLAGS_OTHER})
604 set(CMAKE_REQUIRED_INCLUDES ${EVOLUTION_DATA_SERVER_INCLUDE_DIRS})
605 set(CMAKE_REQUIRED_LIBRARIES ${EVOLUTION_DATA_SERVER_LDFLAGS})
607 CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
609 ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN);
611 }" HAVE_ICAL_UNKNOWN_TOKEN_HANDLING)
613 CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
615 icaltzutil_set_exact_vtimezones_support (0);
617 }" HAVE_ICALTZUTIL_SET_EXACT_VTIMEZONES_SUPPORT)
619 CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
621 icalparameter *param;
622 param = icalproperty_get_first_parameter (NULL, ICAL_FILENAME_PARAMETER);
623 icalparameter_get_filename (param);
624 icalparameter_new_filename (NULL);
626 }" HAVE_ICAL_FILENAME_PARAMETER)
628 unset(CMAKE_REQUIRED_DEFINITIONS)
629 unset(CMAKE_REQUIRED_INCLUDES)
630 unset(CMAKE_REQUIRED_LIBRARIES)
632 # ******************************
634 # ******************************
636 add_printable_option(ENABLE_GTKSPELL "Enable gtkspell usage" ON)
639 pkg_check_modules_for_option(ENABLE_GTKSPELL "gtkspell usage" GTKSPELL gtkspell3-3.0)
640 set(HAVE_GTKSPELL ON)
641 endif(ENABLE_GTKSPELL)
643 # ******************************
644 # gnu_get_libc_version()
645 # ******************************
647 CHECK_C_SOURCE_COMPILES("#include <gnu/libc-version.h>
648 int main(void) { const gchar *libc_version = gnu_get_libc_version (); return 0; }" HAVE_GNU_GET_LIBC_VERSION)
650 # ******************************
652 # ******************************
654 add_printable_variable(ENABLE_PLUGINS "Enable plugins (no/base/all)" "all")
673 # ******************************************************************
674 # The following plugins have additional library dependencies.
675 # They must be explicitly disabled if the libraries are not present.
676 # ******************************************************************
680 add_printable_option(ENABLE_TEXT_HIGHLIGHT "Enable text-highlight plugin" ON)
682 if(ENABLE_TEXT_HIGHLIGHT)
683 find_program(HIGHLIGHT_COMMAND highlight)
685 if(NOT HIGHLIGHT_COMMAND)
686 message(FATAL_ERROR "The 'highlight' program not found; either give it into PATH or disable higlight plugin with -DENABLE_TEXT_HIGHLIGHT=OFF")
687 endif(NOT HIGHLIGHT_COMMAND)
688 endif(ENABLE_TEXT_HIGHLIGHT)
692 add_printable_option(ENABLE_WEATHER "Enable weather calendars" ON)
695 pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar" GWEATHER gweather-3.0>=${gweather_minimum_version})
696 endif(ENABLE_WEATHER)
698 # maps in Contacts preview
700 add_printable_option(ENABLE_CONTACT_MAPS "Enable contact maps" OFF)
702 if(ENABLE_CONTACT_MAPS)
703 pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" CHAMPLAIN champlain-gtk-0.12>=${champlain_minimum_version})
704 pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" GEO geocode-glib-1.0>=${geocode_glib_minimum_version})
705 pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" CLUTTER_GTK clutter-gtk-1.0>=${clutter_gtk_minimum_version})
706 endif(ENABLE_CONTACT_MAPS)
710 add_printable_option(ENABLE_PST_IMPORT "Enable pst-import plugin" ON)
712 if(ENABLE_PST_IMPORT)
713 pkg_check_modules_for_option(ENABLE_PST_IMPORT "pst-import plugin" LIBPST libpst>=${libpst_minimum_version})
714 list(APPEND plugins_standard pst-import)
715 endif(ENABLE_PST_IMPORT)
717 # Finish plugins build setup
720 if(ENABLE_PLUGINS STREQUAL "" OR ENABLE_PLUGINS STREQUAL "all")
721 set(build_plugins ${plugins_base} ${plugins_standard})
722 elseif(ENABLE_PLUGINS STREQUAL "base")
723 set(build_plugins ${plugins_base})
724 elseif(NOT ENABLE_PLUGINS STREQUAL "no")
725 message(FATAL_ERROR "Incorrect value for ENABLE_PLUGINS (${ENABLE_PLUGINS}), use either \"no\", or \"base\" or \"all\" value")
728 # ******************************
730 # ******************************
732 add_printable_option(WITH_GLADE_CATALOG "Install the catalog files for Glade 3 (for maintainers only)" OFF)
734 if(WITH_GLADE_CATALOG)
735 pkg_check_modules_for_option(WITH_GLADE_CATALOG "Glade 3 catalog files" GLADEUI gladeui-2.0>=${gladeui_minimum_version})
736 endif(WITH_GLADE_CATALOG)
738 # Generate the ${PROJECT_NAME}-config.h file
739 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config.h)
741 print_build_options()
743 # The shell_private_requirements is used by the evolution-shell.pc.in
744 if(ENABLE_GNOME_DESKTOP)
745 set(shell_private_requirements "Requires.private: ${GNOME_DESKTOP_DEPENDENCY}")
746 else(ENABLE_GNOME_DESKTOP)
747 set(shell_private_requirements "")
748 endif(ENABLE_GNOME_DESKTOP)
750 # The shell_privlibdir_rpath_flags is used by the evolution-shell.pc.in
751 # and if set, then should be preceded with a space.
753 set(shell_privlibdir_rpath_flags " -Wl,-R${privlibdir}")
756 add_pkgconfig_file(evolution-calendar.pc.in evolution-calendar-${INTERFACE_VERSION}.pc)
757 add_pkgconfig_file(evolution-mail.pc.in evolution-mail-${INTERFACE_VERSION}.pc)
758 add_pkgconfig_file(evolution-shell.pc.in evolution-shell-${INTERFACE_VERSION}.pc)
760 add_subdirectory(data)
762 add_subdirectory(src)
763 add_subdirectory(tests)
766 add_subdirectory(docs)
767 endif(ENABLE_GTK_DOC)
770 add_subdirectory(help)