1 # Evolution build script
3 cmake_minimum_required(VERSION 3.1)
4 cmake_policy(VERSION 3.1)
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")
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)
95 # Load modules from the source tree
96 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
98 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
99 # Packagers might want to need different settings for the RPATH related things
100 # From experience, especially CMAKE_BUILD_WITH_INSTALL_RPATH might need to be
101 # switched to ON, if CMake fails to set the right values during make install
102 set(CMAKE_SKIP_RPATH OFF CACHE BOOL INTERNAL)
103 set(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL INTERNAL)
104 set(CMAKE_BUILD_WITH_INSTALL_RPATH OFF CACHE BOOL INTERNAL)
105 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON CACHE BOOL INTERNAL)
106 # CMAKE_INSTALL_RPATH is set below
109 include(CheckCCompilerFlag)
110 include(CheckCSourceCompiles)
111 include(CheckCSourceRuns)
112 include(CheckFunctionExists)
113 include(CheckIncludeFile)
114 include(CheckLibraryExists)
116 # Project custom modules
117 include(PrintableOptions)
119 add_printable_variable(LIB_SUFFIX "Library directory suffix, usually defined to '64' for x86_64 systems" "")
120 add_printable_variable_bare(CMAKE_INSTALL_PREFIX)
121 add_printable_variable_path(BIN_INSTALL_DIR "Install directory for binary files, defaults to CMAKE_INSTALL_PREFIX/bin" "")
122 add_printable_variable_path(INCLUDE_INSTALL_DIR "Install directory for header files, defaults to CMAKE_INSTALL_PREFIX/include" "")
123 add_printable_variable_path(LIB_INSTALL_DIR "Install directory for library files, defaults to CMAKE_INSTALL_PREFIX/lib{LIB_SUFFIX}" "")
124 add_printable_variable_path(LIBEXEC_INSTALL_DIR "Install directory for library executable files, defaults to CMAKE_INSTALL_PREFIX/libexec" "")
125 add_printable_variable_path(SHARE_INSTALL_PREFIX "Install directory for shared files, defaults to CMAKE_INSTALL_PREFIX/share" "")
126 add_printable_variable_path(LOCALE_INSTALL_DIR "Install directory for locale files, defaults to SHARE_INSTALL_PREFIX/locale" "")
127 add_printable_variable_path(SYSCONF_INSTALL_DIR "Install directory for system configuration files, defaults to CMAKE_INSTALL_PREFIX/etc" "")
129 macro(ensure_default_value _var _defvalue)
130 if(${_var} STREQUAL "")
131 set(${_var} ${_defvalue})
132 endif(${_var} STREQUAL "")
133 endmacro(ensure_default_value)
135 ensure_default_value(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
136 ensure_default_value(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include")
137 ensure_default_value(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
138 ensure_default_value(LIBEXEC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/libexec")
139 ensure_default_value(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share")
140 ensure_default_value(LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale")
141 ensure_default_value(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc")
143 # ******************************
144 # Special directories
145 # ******************************
147 # If you add something here, consider whether or not you also
148 # need to add it to one or more .pc.in files (for Connector, etc)
150 set(privdatadir "${SHARE_INSTALL_PREFIX}/${PROJECT_NAME}")
151 set(privincludedir "${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}")
152 set(privlibdir "${LIB_INSTALL_DIR}/${PROJECT_NAME}")
153 set(privlibexecdir "${LIBEXEC_INSTALL_DIR}/${PROJECT_NAME}")
155 SET(CMAKE_INSTALL_RPATH "${privlibdir}")
158 # On Win32 there is no "rpath" mechanism. We install the private
159 # shared libraries in $libdir, meaning the DLLs will actually be in
160 # $bindir. This means just having $bindir in PATH will be enough.
161 set(privsolibdir "${LIB_INSTALL_DIR}")
163 set(privsolibdir "${privlibdir}")
166 set(errordir "${privdatadir}/errors")
167 set(etspecdir "${privdatadir}/etspec")
168 set(evolutionhelpdir "${privdatadir}/help")
169 set(icondir "${privdatadir}/icons")
170 set(imagesdir "${privdatadir}/images")
171 set(moduledir "${privlibdir}/modules")
172 set(plugindir "${privlibdir}/plugins")
173 set(soundsdir "${privdatadir}/sounds")
174 set(uidir "${privdatadir}/ui")
175 set(viewsdir "${privdatadir}/views")
176 set(webextensionsdir "${privlibdir}/web-extensions")
177 set(webextensionswebkiteditordir "${webextensionsdir}/webkit-editor")
179 # ******************************
181 # ******************************
183 include(CodeCoverageGCOV)
186 include(EvolutionMacros)
190 include(InstalledTests)
192 include(SetupBuildFlags)
193 include(UninstallTarget)
195 include(FindIntltool)
199 add_printable_option(ENABLE_MAINTAINER_MODE "Enable maintainer mode" OFF)
200 add_printable_variable(VERSION_SUBSTRING "Version substring, for packagers" "")
201 add_printable_variable(VERSION_COMMENT "Define if you want a comment appended to the version number" "")
203 if(ENABLE_MAINTAINER_MODE)
204 set(BUILD_TESTING ON)
205 endif(ENABLE_MAINTAINER_MODE)
207 # Setup compiler/linker flags
208 setup_build_flags(${ENABLE_MAINTAINER_MODE})
210 set(MATH_LDFLAGS -lm)
212 CHECK_INCLUDE_FILE(sys/wait.h HAVE_SYS_WAIT_H)
213 CHECK_INCLUDE_FILE(X11/XF86keysym.h HAVE_XFREE)
214 CHECK_FUNCTION_EXISTS(mkdtemp HAVE_MKDTEMP)
215 CHECK_FUNCTION_EXISTS(nl_langinfo HAVE_NL_LANGINFO)
217 # ******************************
219 # ******************************
221 find_program(KILL_PROCESS_COMMAND killall)
222 if(NOT KILL_PROCESS_COMMAND)
223 find_program(KILL_PROCESS_COMMAND pkill)
224 set(KILL_PROCESS_COMMAND_ARGS "-f")
225 set(KILL_PROCESS_COMMAND_ARG_EXACT "-x")
226 else(NOT KILL_PROCESS_COMMAND)
227 set(KILL_PROCESS_COMMAND_ARGS "")
228 set(KILL_PROCESS_COMMAND_ARG_EXACT "-e")
229 endif(NOT KILL_PROCESS_COMMAND)
231 if(NOT KILL_PROCESS_COMMAND)
232 message(WARNING "Could not find a command to kill a process by name")
233 endif(NOT KILL_PROCESS_COMMAND)
235 # ******************************
236 # Check for nl_langinfo features
237 # ******************************
239 CHECK_C_SOURCE_COMPILES("#include <langinfo.h>
240 int main(void) { char *detail = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT); return 0; }" HAVE__NL_MEASUREMENT_MEASUREMENT)
242 # ******************************
244 # ******************************
247 set(GIO_UNIX_REQUIREMENT "gio-windows-2.0")
249 set(GIO_UNIX_REQUIREMENT "gio-unix-2.0")
252 add_printable_option(ENABLE_GNOME_DESKTOP "Enable GNOME desktop dependency for thumbnails" ON)
254 if(ENABLE_GNOME_DESKTOP)
255 set(GNOME_DESKTOP_DEPENDENCY "gnome-desktop-3.0")
256 set(HAVE_GNOME_DESKTOP ON)
258 # It's checked for it twice, this one gives a hint to disable the dependency if not found
259 pkg_check_modules_for_option(ENABLE_GNOME_DESKTOP "GNOME desktop dependency for thumbnails" GNOME_DESKTOP ${GNOME_DESKTOP_DEPENDENCY}>=${gnome_desktop_minimum_version})
260 else(ENABLE_GNOME_DESKTOP)
261 set(GNOME_DESKTOP_DEPENDENCY "")
262 set(HAVE_GNOME_DESKTOP OFF)
263 endif(ENABLE_GNOME_DESKTOP)
265 pkg_check_modules(GNOME_PLATFORM REQUIRED
267 gail-3.0>=${gdk_minimum_version}
268 gcr-3>=${gcr_minimum_version}
269 gdk-pixbuf-2.0>=${gdk_pixbuf_minimum_version}
270 gio-2.0>=${glib_minimum_version}
271 ${GIO_UNIX_REQUIREMENT}
272 gmodule-2.0>=${glib_minimum_version}
273 ${GNOME_DESKTOP_DEPENDENCY}
274 gsettings-desktop-schemas>=${gsettings_desktop_schemas_minimum_version}
275 gtk+-3.0>=${gdk_minimum_version}
276 libxml-2.0>=${libxml_minimum_version}
277 shared-mime-info>=${shared_mime_info_minimum_version}
278 webkit2gtk-4.0>=${webkit2gtk_minimum_version}
281 pkg_check_modules(EVOLUTION_DATA_SERVER REQUIRED
282 camel-1.2>=${eds_minimum_version}
283 libebook-1.2>=${eds_minimum_version}
284 libecal-1.2>=${eds_minimum_version}
285 libedataserver-1.2>=${eds_minimum_version}
286 libedataserverui-1.2>=${eds_minimum_version}
287 libebackend-1.2>=${eds_minimum_version}
290 pkg_check_modules(A11Y REQUIRED atk)
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 # Enchant - support both, but better to use the same as the dependencies (gtkspell3, webkitgtk+,...)
296 # ******************************
298 add_printable_option(WITH_ENCHANT_VERSION "Set Enchant version to use, values are: 'auto' (default), 1 or 2" "auto")
300 if(WITH_ENCHANT_VERSION STREQUAL "1")
301 pkg_check_modules(ENCHANT REQUIRED enchant>=${enchant1_minimum_version})
302 else(WITH_ENCHANT_VERSION STREQUAL "1")
303 if(WITH_ENCHANT_VERSION STREQUAL "2")
304 pkg_check_modules(ENCHANT REQUIRED enchant-2>=${enchant2_minimum_version})
305 else(WITH_ENCHANT_VERSION STREQUAL "2")
306 pkg_check_modules(ENCHANT enchant>=${enchant1_minimum_version})
308 set(WITH_ENCHANT_VERSION "auto (enchant-1)")
311 pkg_check_modules(ENCHANT enchant-2>=${enchant2_minimum_version})
313 set(WITH_ENCHANT_VERSION "auto (enchant-2)")
315 message(FATAL_ERROR "Cannot find enchant 1 neither enchant 2, or new-enough version. Install either of them "
316 "or specify which to use with -DWITH_ENCHANT_VERSION=auto|1|2, where 'auto' is the default")
319 endif(WITH_ENCHANT_VERSION STREQUAL "2")
320 endif(WITH_ENCHANT_VERSION STREQUAL "1")
322 # ******************************
323 # Canberra / Canberra-GTK Sound
324 # ******************************
326 add_printable_option(ENABLE_CANBERRA "Enable Canberra and Canberra-GTK sound" ON)
329 pkg_check_modules_for_option(ENABLE_CANBERRA "Canberra and Canberra-GTK sound" CANBERRA libcanberra-gtk3>=${libcanberra_gtk_minimum_version})
330 set(HAVE_CANBERRA ON)
331 endif(ENABLE_CANBERRA)
333 # ******************************
334 # Archives Integration / gnome-autoar
335 # ******************************
337 add_printable_option(ENABLE_AUTOAR "Enable archives support in attachments" ON)
340 pkg_check_modules_for_option(ENABLE_AUTOAR "archives support in attachments" AUTOAR
341 gnome-autoar-0>=${gnome_autoar_minimum_version}
342 gnome-autoar-gtk-0>=${gnome_autoar_minimum_version}
347 # ******************************
349 # ******************************
351 add_printable_option(WITH_HELP "Build user documentation" ON)
354 find_program(ITSTOOL itstool)
356 message(FATAL_ERROR "Cannot find itstool, either install it or disable help build by adding -DWITH_HELP=OFF argument to cmake command")
360 # ******************************
362 # ******************************
364 set(CMAKE_REQUIRED_LIBRARIES "-liconv")
365 CHECK_C_SOURCE_COMPILES("#include <iconv.h>
367 int main(void) { iconv_t cd; cd = iconv_open (\"UTF-8\", \"ISO-8859-1\"); return 0; }" HAVE_LIBICONV)
368 unset(CMAKE_REQUIRED_LIBRARIES)
371 set(ICONV_LIBS "-liconv")
375 CHECK_FUNCTION_EXISTS(iconv HAVE_ICONV)
379 message(FATAL_ERROR "You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv")
380 endif(NOT HAVE_ICONV)
382 set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBS})
383 CHECK_C_SOURCE_RUNS("#include \"${CMAKE_SOURCE_DIR}/iconv-detect.c\"" _correct_iconv)
384 unset(CMAKE_REQUIRED_LIBRARIES)
386 if(NOT _correct_iconv)
387 message(FATAL_ERROR "You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv")
388 endif(NOT _correct_iconv)
390 # ******************************
392 # ******************************
394 CHECK_C_SOURCE_COMPILES("#include <time.h>
395 int main(void) { struct tm tm; tm.tm_gmtoff = 1; return 0; }" HAVE_TM_GMTOFF)
397 CHECK_C_SOURCE_COMPILES("#include <time.h>
398 int main(void) { timezone = 1; return 0; }" HAVE_TIMEZONE)
400 CHECK_C_SOURCE_COMPILES("#include <time.h>
401 int main(void) { altzone = 1; return 0; }" HAVE_ALTZONE)
403 if((NOT HAVE_TM_GMTOFF) AND (NOT HAVE_TIMEZONE))
404 message(FATAL_ERROR "Unable to find a way to determine timezone")
405 endif((NOT HAVE_TM_GMTOFF) AND (NOT HAVE_TIMEZONE))
407 # ******************************
409 # ******************************
411 pkg_check_exists(HAVE_ISO_CODES iso-codes)
413 pkg_check_at_least_version(HAVE_ISO_CODES iso-codes 0.49)
415 pkg_check_variable(_iso_codes_domains iso-codes domains)
416 if(NOT ((_iso_codes_domains MATCHES "639") AND (_iso_codes_domains MATCHES "3166")))
417 message(WARNING "iso-codes detected, but either iso-639 or iso-3166 domains not found in '${_iso_codes_domains}'")
418 set(HAVE_ISO_CODES OFF)
420 pkg_check_variable(ISO_CODES_PREFIX iso-codes prefix)
423 set(HAVE_ISO_CODES OFF)
424 message(WARNING "iso-codes detected, but version 0.49 or later is required due to licensing")
425 endif(HAVE_ISO_CODES)
426 endif(HAVE_ISO_CODES)
428 # ******************************
429 # libcryptui, aka Seahorse
430 # ******************************
432 add_printable_option(ENABLE_LIBCRYPTUI "Enable libcryptui usage" ON)
434 if(ENABLE_LIBCRYPTUI)
435 pkg_check_modules_for_option(ENABLE_LIBCRYPTUI "libcryptui usage" LIBCRYPTUI cryptui-0.0)
436 set(HAVE_LIBCRYPTUI ON)
437 endif(ENABLE_LIBCRYPTUI)
439 # ******************************
440 # TNEF implementation
441 # ******************************
443 add_printable_option(ENABLE_YTNEF "Enable yTNEF library usage" ON)
446 set(TNEF_LDFLAGS -lytnef)
448 set(CMAKE_REQUIRED_LIBRARIES ${TNEF_LDFLAGS})
449 CHECK_C_SOURCE_COMPILES("#include <stdio.h>
451 int main(void) { TNEFStruct *tnef; return 0; }" HAVE_YTNEF_H)
454 CHECK_C_SOURCE_COMPILES("#include <stdio.h>
455 #include <libytnef/ytnef.h>
456 int main(void) { TNEFStruct *tnef; return 0; }" HAVE_LIBYTNEF_YTNEF_H)
457 endif(NOT HAVE_YTNEF_H)
458 unset(CMAKE_REQUIRED_LIBRARIES)
460 if((NOT HAVE_YTNEF_H) AND (NOT HAVE_LIBYTNEF_YTNEF_H))
461 message(FATAL_ERROR "Cannot find ytnef library, either install it or disable use of it by adding -DENABLE_YTNEF=OFF argument to cmake command")
462 endif((NOT HAVE_YTNEF_H) AND (NOT HAVE_LIBYTNEF_YTNEF_H))
465 # ******************************
466 # Bogofilter (spam filter)
467 # ******************************
469 add_printable_variable_path(WITH_BOGOFILTER "Enable spam filtering using Bogofilter (defaults to /usr/bin/bogofilter)" ON)
471 string(LENGTH "${CMAKE_BINARY_DIR}" bindirlen)
472 string(LENGTH "${WITH_BOGOFILTER}" maxlen)
473 if(maxlen LESS bindirlen)
475 else(maxlen LESS bindirlen)
476 string(SUBSTRING "${WITH_BOGOFILTER}" 0 ${bindirlen} substr)
477 endif(maxlen LESS bindirlen)
478 string(TOUPPER "${WITH_BOGOFILTER}" optupper)
480 set(BOGOFILTER_COMMAND "")
481 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
482 set(WITH_BOGOFILTER ON)
483 elseif(("${optupper}" STREQUAL "OFF") OR ("${optupper}" STREQUAL "NO"))
484 set(WITH_BOGOFILTER OFF)
486 set(BOGOFILTER_COMMAND "${WITH_BOGOFILTER}")
487 set(WITH_BOGOFILTER ON)
491 if(BOGOFILTER_COMMAND STREQUAL "")
492 set(BOGOFILTER_COMMAND "$ENV{BOGOFILTER}")
493 endif(BOGOFILTER_COMMAND STREQUAL "")
494 if(BOGOFILTER_COMMAND STREQUAL "")
495 set(BOGOFILTER_COMMAND "/usr/bin/bogofilter")
496 endif(BOGOFILTER_COMMAND STREQUAL "")
497 endif(WITH_BOGOFILTER)
504 # ******************************
505 # SpamAssassin (spam filter)
506 # ******************************
508 add_printable_variable_path(WITH_SPAMASSASSIN "Enable spam filtering using SpamAssassin (defaults to /usr/bin/spamassassin)" ON)
509 add_printable_variable_path(WITH_SA_LEARN "Full path command where sa-learn is located (defaults to /usr/bin/sa-learn)" ON)
511 string(LENGTH "${CMAKE_BINARY_DIR}" bindirlen)
512 string(LENGTH "${WITH_SPAMASSASSIN}" maxlen)
513 if(maxlen LESS bindirlen)
515 else(maxlen LESS bindirlen)
516 string(SUBSTRING "${WITH_SPAMASSASSIN}" 0 ${bindirlen} substr)
517 endif(maxlen LESS bindirlen)
518 string(TOUPPER "${WITH_SPAMASSASSIN}" optupper)
520 set(SPAMASSASSIN_COMMAND "")
521 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
522 set(WITH_SPAMASSASSIN ON)
523 elseif(("${optupper}" STREQUAL "OFF") OR ("${optupper}" STREQUAL "NO"))
524 set(WITH_SPAMASSASSIN OFF)
526 set(SPAMASSASSIN_COMMAND "${WITH_SPAMASSASSIN}")
527 set(WITH_SPAMASSASSIN ON)
530 if(WITH_SPAMASSASSIN)
531 if(SPAMASSASSIN_COMMAND STREQUAL "")
532 set(SPAMASSASSIN_COMMAND "$ENV{SPAMASSASSIN}")
533 endif(SPAMASSASSIN_COMMAND STREQUAL "")
534 if(SPAMASSASSIN_COMMAND STREQUAL "")
535 set(SPAMASSASSIN_COMMAND "/usr/bin/spamassassin")
536 endif(SPAMASSASSIN_COMMAND STREQUAL "")
538 string(LENGTH "${WITH_SA_LEARN}" maxlen)
539 if(maxlen LESS bindirlen)
541 else(maxlen LESS bindirlen)
542 string(SUBSTRING "${WITH_SA_LEARN}" 0 ${bindirlen} substr)
543 endif(maxlen LESS bindirlen)
544 string(TOUPPER "${WITH_SA_LEARN}" optupper)
546 set(SA_LEARN_COMMAND "")
547 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
548 set(WITH_SA_LEARN ON)
549 elseif(("${optupper}" STREQUAL "OFF") OR ("${optupper}" STREQUAL "NO"))
550 set(WITH_SA_LEARN OFF)
552 set(SA_LEARN_COMMAND "${WITH_SA_LEARN}")
553 set(WITH_SA_LEARN ON)
556 if(SA_LEARN_COMMAND STREQUAL "")
557 set(SA_LEARN_COMMAND "$ENV{SA_LEARN}")
558 endif(SA_LEARN_COMMAND STREQUAL "")
559 if(SA_LEARN_COMMAND STREQUAL "")
560 set(SA_LEARN_COMMAND "/usr/bin/sa-learn")
561 endif(SA_LEARN_COMMAND STREQUAL "")
562 endif(WITH_SPAMASSASSIN)
569 # ******************************
571 # ******************************
573 # Here we want the Mozilla flags to go *before* the other ones,
574 # especially the mozilla-nss -I flags to go before the gnutls ones,
575 # as both gnutls and mozilla-nss have a header called "pkcs12.h" which is
576 # included in smime/lib/e-pkcs12.c. It wants the Mozilla NSS one.
578 set(CERT_UI_INCLUDES ${MANUAL_NSPR_INCLUDES})
579 set(CERT_UI_LIBS ${MANUAL_NSPR_LIBS})
581 # ******************************
583 # ******************************
585 pkg_check_modules(LIBNOTIFY libnotify>=${libnotify_minimum_version})
586 set(HAVE_LIBNOTIFY ${LIBNOTIFY_FOUND})
588 # ******************************
590 # ******************************
592 set(CMAKE_REQUIRED_DEFINITIONS ${EVOLUTION_DATA_SERVER_CFLAGS_OTHER})
593 set(CMAKE_REQUIRED_INCLUDES ${EVOLUTION_DATA_SERVER_INCLUDE_DIRS})
594 set(CMAKE_REQUIRED_LIBRARIES ${EVOLUTION_DATA_SERVER_LDFLAGS})
596 CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
598 ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN);
600 }" HAVE_ICAL_UNKNOWN_TOKEN_HANDLING)
602 CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
604 icaltzutil_set_exact_vtimezones_support (0);
606 }" HAVE_ICALTZUTIL_SET_EXACT_VTIMEZONES_SUPPORT)
608 CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
610 icalparameter *param;
611 param = icalproperty_get_first_parameter (NULL, ICAL_FILENAME_PARAMETER);
612 icalparameter_get_filename (param);
613 icalparameter_new_filename (NULL);
615 }" HAVE_ICAL_FILENAME_PARAMETER)
617 unset(CMAKE_REQUIRED_DEFINITIONS)
618 unset(CMAKE_REQUIRED_INCLUDES)
619 unset(CMAKE_REQUIRED_LIBRARIES)
621 # ******************************
623 # ******************************
625 add_printable_option(ENABLE_GTKSPELL "Enable gtkspell usage" ON)
628 pkg_check_modules_for_option(ENABLE_GTKSPELL "gtkspell usage" GTKSPELL gtkspell3-3.0)
629 set(HAVE_GTKSPELL ON)
630 endif(ENABLE_GTKSPELL)
632 # ******************************
633 # gnu_get_libc_version()
634 # ******************************
636 CHECK_C_SOURCE_COMPILES("#include <gnu/libc-version.h>
637 int main(void) { const gchar *libc_version = gnu_get_libc_version (); return 0; }" HAVE_GNU_GET_LIBC_VERSION)
639 # ******************************
641 # ******************************
643 add_printable_variable(ENABLE_PLUGINS "Enable plugins (no/base/all)" "all")
662 # ******************************************************************
663 # The following plugins have additional library dependencies.
664 # They must be explicitly disabled if the libraries are not present.
665 # ******************************************************************
669 add_printable_option(ENABLE_TEXT_HIGHLIGHT "Enable text-highlight plugin" ON)
671 if(ENABLE_TEXT_HIGHLIGHT)
672 find_program(HIGHLIGHT_COMMAND highlight)
674 if(NOT HIGHLIGHT_COMMAND)
675 message(FATAL_ERROR "The 'highlight' program not found; either give it into PATH or disable higlight plugin with -DENABLE_TEXT_HIGHLIGHT=OFF")
676 endif(NOT HIGHLIGHT_COMMAND)
677 endif(ENABLE_TEXT_HIGHLIGHT)
681 add_printable_option(ENABLE_WEATHER "Enable weather calendars" ON)
684 pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar" GWEATHER gweather-3.0>=${gweather_minimum_version})
685 endif(ENABLE_WEATHER)
687 # maps in Contacts preview
689 add_printable_option(ENABLE_CONTACT_MAPS "Enable contact maps" OFF)
691 if(ENABLE_CONTACT_MAPS)
692 pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" CHAMPLAIN champlain-gtk-0.12>=${champlain_minimum_version})
693 pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" GEO geocode-glib-1.0>=${geocode_glib_minimum_version})
694 pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" CLUTTER_GTK clutter-gtk-1.0>=${clutter_gtk_minimum_version})
695 endif(ENABLE_CONTACT_MAPS)
699 add_printable_option(ENABLE_PST_IMPORT "Enable pst-import plugin" ON)
701 if(ENABLE_PST_IMPORT)
702 pkg_check_modules_for_option(ENABLE_PST_IMPORT "pst-import plugin" LIBPST libpst>=${libpst_minimum_version})
703 list(APPEND plugins_standard pst-import)
704 endif(ENABLE_PST_IMPORT)
706 # Finish plugins build setup
709 if(ENABLE_PLUGINS STREQUAL "" OR ENABLE_PLUGINS STREQUAL "all")
710 set(build_plugins ${plugins_base} ${plugins_standard})
711 elseif(ENABLE_PLUGINS STREQUAL "base")
712 set(build_plugins ${plugins_base})
713 elseif(NOT ENABLE_PLUGINS STREQUAL "no")
714 message(FATAL_ERROR "Incorrect value for ENABLE_PLUGINS (${ENABLE_PLUGINS}), use either \"no\", or \"base\" or \"all\" value")
717 # ******************************
719 # ******************************
721 add_printable_option(WITH_GLADE_CATALOG "Install the catalog files for Glade 3 (for maintainers only)" OFF)
723 if(WITH_GLADE_CATALOG)
724 pkg_check_modules_for_option(WITH_GLADE_CATALOG "Glade 3 catalog files" GLADEUI gladeui-2.0>=${gladeui_minimum_version})
725 endif(WITH_GLADE_CATALOG)
727 # Generate the ${PROJECT_NAME}-config.h file
728 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config.h)
730 print_build_options()
732 # The shell_private_requirements is used by the evolution-shell.pc.in
733 if(ENABLE_GNOME_DESKTOP)
734 set(shell_private_requirements "Requires.private: ${GNOME_DESKTOP_DEPENDENCY}")
735 else(ENABLE_GNOME_DESKTOP)
736 set(shell_private_requirements "")
737 endif(ENABLE_GNOME_DESKTOP)
739 # The shell_privlibdir_rpath_flags is used by the evolution-shell.pc.in
740 # and if set, then should be preceded with a space.
742 set(shell_privlibdir_rpath_flags " -Wl,-R${privlibdir}")
745 add_pkgconfig_file(evolution-calendar.pc.in evolution-calendar-${INTERFACE_VERSION}.pc)
746 add_pkgconfig_file(evolution-mail.pc.in evolution-mail-${INTERFACE_VERSION}.pc)
747 add_pkgconfig_file(evolution-shell.pc.in evolution-shell-${INTERFACE_VERSION}.pc)
749 add_subdirectory(data)
751 add_subdirectory(src)
752 add_subdirectory(tests)
755 add_subdirectory(docs)
756 endif(ENABLE_GTK_DOC)
759 add_subdirectory(help)