Update zh_CN translation
[evolution.git] / CMakeLists.txt
blob3711bdf2ee2f824d2f681577737635a5b1cf4b22
1 # Evolution build script
3 cmake_minimum_required(VERSION 3.1)
4 cmake_policy(VERSION 3.1)
6 project(evolution
7         VERSION 3.23.91
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.24)
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}-${BASE_VERSION})
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.10)
54 set(gdk_encoded_version GDK_VERSION_3_10)
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})
74 set(enchant_minimum_version 1.1.7)
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.13.90)
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)
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 "${LIB_INSTALL_DIR}:${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 endif(NOT KILL_PROCESS_COMMAND)
225 if(NOT KILL_PROCESS_COMMAND)
226         message(WARNING "Could not find a command to kill a process by name")
227 endif(NOT KILL_PROCESS_COMMAND)
229 # ******************************
230 # Check for nl_langinfo features
231 # ******************************
233 CHECK_C_SOURCE_COMPILES("#include <langinfo.h>
234                         int main(void) { char *detail = nl_langinfo (_NL_MEASUREMENT_MEASUREMENT); return 0; }" HAVE__NL_MEASUREMENT_MEASUREMENT)
236 # ******************************
237 # Dependencies
238 # ******************************
240 if(WIN32)
241         set(GIO_UNIX_REQUIREMENT "gio-windows-2.0")
242 else(WIN32)
243         set(GIO_UNIX_REQUIREMENT "gio-unix-2.0")
244 endif(WIN32)
246 add_printable_option(ENABLE_GNOME_DESKTOP "Enable GNOME desktop dependency for thumbnails" ON)
248 if(ENABLE_GNOME_DESKTOP)
249         set(GNOME_DESKTOP_DEPENDENCY "gnome-desktop-3.0")
250         set(HAVE_GNOME_DESKTOP ON)
252         # It's checked for it twice, this one gives a hint to disable the dependency if not found
253         pkg_check_modules_for_option(ENABLE_GNOME_DESKTOP "GNOME desktop dependency for thumbnails" GNOME_DESKTOP ${GNOME_DESKTOP_DEPENDENCY}>=${gnome_desktop_minimum_version})
254 else(ENABLE_GNOME_DESKTOP)
255         set(GNOME_DESKTOP_DEPENDENCY "")
256         set(HAVE_GNOME_DESKTOP OFF)
257 endif(ENABLE_GNOME_DESKTOP)
259 pkg_check_modules(GNOME_PLATFORM REQUIRED
260         cairo-gobject
261         gail-3.0>=${gdk_minimum_version}
262         gcr-3>=${gcr_minimum_version}
263         gdk-pixbuf-2.0>=${gdk_pixbuf_minimum_version}
264         gio-2.0>=${glib_minimum_version}
265         ${GIO_UNIX_REQUIREMENT}
266         gmodule-2.0>=${glib_minimum_version}
267         ${GNOME_DESKTOP_DEPENDENCY}
268         gsettings-desktop-schemas>=${gsettings_desktop_schemas_minimum_version}
269         gtk+-3.0>=${gdk_minimum_version}
270         libxml-2.0>=${libxml_minimum_version}
271         shared-mime-info>=${shared_mime_info_minimum_version}
272         webkit2gtk-4.0>=${webkit2gtk_minimum_version}
275 pkg_check_modules(EVOLUTION_DATA_SERVER REQUIRED
276         camel-1.2>=${eds_minimum_version}
277         libebook-1.2>=${eds_minimum_version}
278         libecal-1.2>=${eds_minimum_version}
279         libedataserver-1.2>=${eds_minimum_version}
280         libedataserverui-1.2>=${eds_minimum_version}
281         libebackend-1.2>=${eds_minimum_version}
284 pkg_check_modules(A11Y REQUIRED atk)
285 pkg_check_modules(ENCHANT REQUIRED enchant>=${enchant_minimum_version})
286 pkg_check_modules(LIBSOUP REQUIRED libsoup-2.4>=${soup_minimum_version})
287 pkg_check_modules(WEB_EXTENSION REQUIRED webkit2gtk-4.0>=${webkit2gtk_minimum_version})
289 # ******************************
290 # Canberra / Canberra-GTK Sound
291 # ******************************
293 add_printable_option(ENABLE_CANBERRA "Enable Canberra and Canberra-GTK sound" ON)
295 if(ENABLE_CANBERRA)
296         pkg_check_modules_for_option(ENABLE_CANBERRA "Canberra and Canberra-GTK sound" CANBERRA libcanberra-gtk3>=${libcanberra_gtk_minimum_version})
297         set(HAVE_CANBERRA ON)
298 endif(ENABLE_CANBERRA)
300 # ******************************
301 # Archives Integration / gnome-autoar
302 # ******************************
304 add_printable_option(ENABLE_AUTOAR "Enable archives support in attachments" ON)
306 if(ENABLE_AUTOAR)
307         pkg_check_modules_for_option(ENABLE_AUTOAR "archives support in attachments" AUTOAR
308                 gnome-autoar-0>=${gnome_autoar_minimum_version}
309                 gnome-autoar-gtk-0>=${gnome_autoar_minimum_version}
310         )
311         set(HAVE_AUTOAR ON)
312 endif(ENABLE_AUTOAR)
314 # ******************************
315 # User Documentation
316 # ******************************
318 add_printable_option(WITH_HELP "Build user documentation" ON)
320 if(WITH_HELP)
321         find_program(ITSTOOL itstool)
322         if(NOT ITSTOOL)
323                 message(FATAL_ERROR "Cannot find itstool, either install it or disable help build by adding -DWITH_HELP=OFF argument to cmake command")
324         endif(NOT ITSTOOL)
325 endif(WITH_HELP)
327 # ******************************
328 # iconv checking
329 # ******************************
331 set(CMAKE_REQUIRED_LIBRARIES "-liconv")
332 CHECK_C_SOURCE_COMPILES("#include <iconv.h>
333                         #include <stdlib.h>
334                         int main(void) { iconv_t cd; cd = iconv_open (\"UTF-8\", \"ISO-8859-1\"); return 0; }" HAVE_LIBICONV)
335 unset(CMAKE_REQUIRED_LIBRARIES)
337 if(HAVE_LIBICONV)
338         set(ICONV_LIBS "-liconv")
339         set(HAVE_ICONV ON)
340 else(HAVE_LIBICONV)
341         set(ICONV_LIBS "")
342         CHECK_FUNCTION_EXISTS(iconv HAVE_ICONV)
343 endif(HAVE_LIBICONV)
345 if(NOT HAVE_ICONV)
346         message(FATAL_ERROR "You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv")
347 endif(NOT HAVE_ICONV)
349 set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBS})
350 CHECK_C_SOURCE_RUNS("#include \"${CMAKE_SOURCE_DIR}/iconv-detect.c\"" _correct_iconv)
351 unset(CMAKE_REQUIRED_LIBRARIES)
353 if(NOT _correct_iconv)
354         message(FATAL_ERROR "You need to install a working iconv implementation, such as ftp://ftp.gnu.org/pub/gnu/libiconv")
355 endif(NOT _correct_iconv)
357 # ******************************
358 # Timezone checks
359 # ******************************
361 CHECK_C_SOURCE_COMPILES("#include <time.h>
362                         int main(void) { struct tm tm; tm.tm_gmtoff = 1; return 0; }" HAVE_TM_GMTOFF)
364 CHECK_C_SOURCE_COMPILES("#include <time.h>
365                         int main(void) { timezone = 1; return 0; }" HAVE_TIMEZONE)
367 CHECK_C_SOURCE_COMPILES("#include <time.h>
368                         int main(void) { altzone = 1; return 0; }" HAVE_ALTZONE)
370 if((NOT HAVE_TM_GMTOFF) AND (NOT HAVE_TIMEZONE))
371         message(FATAL_ERROR "Unable to find a way to determine timezone")
372 endif((NOT HAVE_TM_GMTOFF) AND (NOT HAVE_TIMEZONE))
374 # ******************************
375 # iso-codes
376 # ******************************
378 pkg_check_exists(HAVE_ISO_CODES iso-codes)
379 if(HAVE_ISO_CODES)
380         pkg_check_at_least_version(HAVE_ISO_CODES iso-codes 0.49)
381         if(HAVE_ISO_CODES)
382                 pkg_check_variable(_iso_codes_domains iso-codes domains)
383                 if(NOT ((_iso_codes_domains MATCHES "639") AND (_iso_codes_domains MATCHES "3166")))
384                         message(WARNING "iso-codes detected, but either iso-639 or iso-3166 domains not found in '${_iso_codes_domains}'")
385                         set(HAVE_ISO_CODES OFF)
386                 else()
387                         pkg_check_variable(ISO_CODES_PREFIX iso-codes prefix)
388                 endif()
389         else(HAVE_ISO_CODES)
390                 set(HAVE_ISO_CODES OFF)
391                 message(WARNING "iso-codes detected, but version 0.49 or later is required due to licensing")
392         endif(HAVE_ISO_CODES)
393 endif(HAVE_ISO_CODES)
395 # ******************************
396 # libcryptui, aka Seahorse
397 # ******************************
399 add_printable_option(ENABLE_LIBCRYPTUI "Enable libcryptui usage" ON)
401 if(ENABLE_LIBCRYPTUI)
402         pkg_check_modules_for_option(ENABLE_LIBCRYPTUI "libcryptui usage" LIBCRYPTUI cryptui-0.0)
403         set(HAVE_LIBCRYPTUI ON)
404 endif(ENABLE_LIBCRYPTUI)
406 # ******************************
407 # TNEF implementation
408 # ******************************
410 add_printable_option(ENABLE_YTNEF "Enable yTNEF library usage" ON)
412 if(ENABLE_YTNEF)
413         set(TNEF_LDFLAGS -lytnef)
415         set(CMAKE_REQUIRED_LIBRARIES ${TNEF_LDFLAGS})
416         CHECK_C_SOURCE_COMPILES("#include <stdio.h>
417                                 #include <ytnef.h>
418                                 int main(void) { TNEFStruct *tnef; return 0; }" HAVE_YTNEF_H)
420         if(NOT HAVE_YTNEF_H)
421                 CHECK_C_SOURCE_COMPILES("#include <stdio.h>
422                                         #include <libytnef/ytnef.h>
423                                         int main(void) { TNEFStruct *tnef; return 0; }" HAVE_LIBYTNEF_YTNEF_H)
424         endif(NOT HAVE_YTNEF_H)
425         unset(CMAKE_REQUIRED_LIBRARIES)
427         if((NOT HAVE_YTNEF_H) AND (NOT HAVE_LIBYTNEF_YTNEF_H))
428                 message(FATAL_ERROR "Cannot find ytnef library, either install it or disable use of it by adding -DENABLE_YTNEF=OFF argument to cmake command")
429         endif((NOT HAVE_YTNEF_H) AND (NOT HAVE_LIBYTNEF_YTNEF_H))
430 endif(ENABLE_YTNEF)
432 # ******************************
433 # Bogofilter (spam filter)
434 # ******************************
436 add_printable_variable_path(WITH_BOGOFILTER "Enable spam filtering using Bogofilter (defaults to /usr/bin/bogofilter)" ON)
438 string(LENGTH "${CMAKE_BINARY_DIR}" bindirlen)
439 string(LENGTH "${WITH_BOGOFILTER}" maxlen)
440 if(maxlen LESS bindirlen)
441         set(substr "***")
442 else(maxlen LESS bindirlen)
443         string(SUBSTRING "${WITH_BOGOFILTER}" 0 ${bindirlen} substr)
444 endif(maxlen LESS bindirlen)
445 string(TOUPPER "${WITH_BOGOFILTER}" optupper)
447 set(BOGOFILTER_COMMAND "")
448 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
449         set(WITH_BOGOFILTER ON)
450 elseif(("${optupper}" STREQUAL "OFF") OR ("${optupper}" STREQUAL "NO"))
451         set(WITH_BOGOFILTER OFF)
452 else()
453         set(BOGOFILTER_COMMAND "${WITH_BOGOFILTER}")
454         set(WITH_BOGOFILTER ON)
455 endif()
457 if(WITH_BOGOFILTER)
458         if(BOGOFILTER_COMMAND STREQUAL "")
459                 set(BOGOFILTER_COMMAND "$ENV{BOGOFILTER}")
460         endif(BOGOFILTER_COMMAND STREQUAL "")
461         if(BOGOFILTER_COMMAND STREQUAL "")
462                 set(BOGOFILTER_COMMAND "/usr/bin/bogofilter")
463         endif(BOGOFILTER_COMMAND STREQUAL "")
464 endif(WITH_BOGOFILTER)
466 unset(bindirlen)
467 unset(maxlen)
468 unset(substr)
469 unset(optupper)
471 # ******************************
472 # SpamAssassin (spam filter)
473 # ******************************
475 add_printable_variable_path(WITH_SPAMASSASSIN "Enable spam filtering using SpamAssassin (defaults to /usr/bin/spamassassin)" ON)
476 add_printable_variable_path(WITH_SA_LEARN "Full path command where sa-learn is located (defaults to /usr/bin/sa-learn)" ON)
478 string(LENGTH "${CMAKE_BINARY_DIR}" bindirlen)
479 string(LENGTH "${WITH_SPAMASSASSIN}" maxlen)
480 if(maxlen LESS bindirlen)
481         set(substr "***")
482 else(maxlen LESS bindirlen)
483         string(SUBSTRING "${WITH_SPAMASSASSIN}" 0 ${bindirlen} substr)
484 endif(maxlen LESS bindirlen)
485 string(TOUPPER "${WITH_SPAMASSASSIN}" optupper)
487 set(SPAMASSASSIN_COMMAND "")
488 if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
489         set(WITH_SPAMASSASSIN ON)
490 elseif(("${optupper}" STREQUAL "OFF") OR ("${optupper}" STREQUAL "NO"))
491         set(WITH_SPAMASSASSIN OFF)
492 else()
493         set(SPAMASSASSIN_COMMAND "${WITH_SPAMASSASSIN}")
494         set(WITH_SPAMASSASSIN ON)
495 endif()
497 if(WITH_SPAMASSASSIN)
498         if(SPAMASSASSIN_COMMAND STREQUAL "")
499                 set(SPAMASSASSIN_COMMAND "$ENV{SPAMASSASSIN}")
500         endif(SPAMASSASSIN_COMMAND STREQUAL "")
501         if(SPAMASSASSIN_COMMAND STREQUAL "")
502                 set(SPAMASSASSIN_COMMAND "/usr/bin/spamassassin")
503         endif(SPAMASSASSIN_COMMAND STREQUAL "")
505         string(LENGTH "${WITH_SA_LEARN}" maxlen)
506         if(maxlen LESS bindirlen)
507                 set(substr "***")
508         else(maxlen LESS bindirlen)
509                 string(SUBSTRING "${WITH_SA_LEARN}" 0 ${bindirlen} substr)
510         endif(maxlen LESS bindirlen)
511         string(TOUPPER "${WITH_SA_LEARN}" optupper)
513         set(SA_LEARN_COMMAND "")
514         if(("${optupper}" STREQUAL "ON") OR ("${substr}" STREQUAL "${CMAKE_BINARY_DIR}"))
515                 set(WITH_SA_LEARN ON)
516         elseif(("${optupper}" STREQUAL "OFF") OR ("${optupper}" STREQUAL "NO"))
517                 set(WITH_SA_LEARN OFF)
518         else()
519                 set(SA_LEARN_COMMAND "${WITH_SA_LEARN}")
520                 set(WITH_SA_LEARN ON)
521         endif()
523         if(SA_LEARN_COMMAND STREQUAL "")
524                 set(SA_LEARN_COMMAND "$ENV{SA_LEARN}")
525         endif(SA_LEARN_COMMAND STREQUAL "")
526         if(SA_LEARN_COMMAND STREQUAL "")
527                 set(SA_LEARN_COMMAND "/usr/bin/sa-learn")
528         endif(SA_LEARN_COMMAND STREQUAL "")
529 endif(WITH_SPAMASSASSIN)
531 unset(bindirlen)
532 unset(maxlen)
533 unset(substr)
534 unset(optupper)
536 # ******************************
537 # CERT_UI Flags
538 # ******************************
540 # Here we want the Mozilla flags to go *before* the other ones,
541 # especially the mozilla-nss -I flags to go before the gnutls ones,
542 # as both gnutls and mozilla-nss have a header called "pkcs12.h" which is
543 # included in smime/lib/e-pkcs12.c. It wants the Mozilla NSS one.
545 set(CERT_UI_INCLUDES ${MANUAL_NSPR_INCLUDES})
546 set(CERT_UI_LIBS ${MANUAL_NSPR_LIBS})
548 # ******************************
549 # Libnotify
550 # ******************************
552 pkg_check_modules(LIBNOTIFY libnotify>=${libnotify_minimum_version})
553 set(HAVE_LIBNOTIFY ${LIBNOTIFY_FOUND})
555 # ******************************
556 # libical tweaks
557 # ******************************
559 set(CMAKE_REQUIRED_DEFINITIONS ${EVOLUTION_DATA_SERVER_CFLAGS_OTHER})
560 set(CMAKE_REQUIRED_INCLUDES ${EVOLUTION_DATA_SERVER_INCLUDE_DIRS})
561 set(CMAKE_REQUIRED_LIBRARIES ${EVOLUTION_DATA_SERVER_LDFLAGS})
563 CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
564                         int main(void) {
565                                 ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN);
566                                 return 0;
567                         }" HAVE_ICAL_UNKNOWN_TOKEN_HANDLING)
569 CHECK_C_SOURCE_COMPILES("#include <libical/ical.h>
570                         int main(void) {
571                                 icaltzutil_set_exact_vtimezones_support (0);
572                                 return 0;
573                         }" HAVE_ICALTZUTIL_SET_EXACT_VTIMEZONES_SUPPORT)
575 unset(CMAKE_REQUIRED_DEFINITIONS)
576 unset(CMAKE_REQUIRED_INCLUDES)
577 unset(CMAKE_REQUIRED_LIBRARIES)
579 # ******************************
580 # gtkspell
581 # ******************************
583 add_printable_option(ENABLE_GTKSPELL "Enable gtkspell usage" ON)
585 if(ENABLE_GTKSPELL)
586         pkg_check_modules_for_option(ENABLE_GTKSPELL "gtkspell usage" GTKSPELL gtkspell3-3.0)
587         set(HAVE_GTKSPELL ON)
588 endif(ENABLE_GTKSPELL)
590 # ******************************
591 # gnu_get_libc_version()
592 # ******************************
594 CHECK_C_SOURCE_COMPILES("#include <gnu/libc-version.h>
595                         int main(void) { const gchar *libc_version = gnu_get_libc_version (); return 0; }" HAVE_GNU_GET_LIBC_VERSION)
597 # ******************************
598 # Plugins
599 # ******************************
601 add_printable_variable(ENABLE_PLUGINS "Enable plugins (no/base/all)" "all")
603 set(plugins_base
604         publish-calendar
606 set(plugins_standard
607         attachment-reminder
608         bbdb
609         dbx-import
610         email-custom-header
611         external-editor
612         face
613         mail-to-task
614         mailing-list-actions
615         mail-notification
616         save-calendar
617         templates
620 # ******************************************************************
621 # The following plugins have additional library dependencies.
622 # They must be explicitly disabled if the libraries are not present.
623 # ******************************************************************
625 # text-highlight
627 add_printable_option(ENABLE_TEXT_HIGHLIGHT "Enable text-highlight plugin" ON)
629 if(ENABLE_TEXT_HIGHLIGHT)
630         find_program(HIGHLIGHT_COMMAND highlight)
632         if(NOT HIGHLIGHT_COMMAND)
633                 message(FATAL_ERROR "The 'highlight' program not found; either give it into PATH or disable higlight plugin with -DENABLE_TEXT_HIGHLIGHT=OFF")
634         endif(NOT HIGHLIGHT_COMMAND)
635 endif(ENABLE_TEXT_HIGHLIGHT)
637 # weather calendar
639 add_printable_option(ENABLE_WEATHER "Enable weather calendars" ON)
641 if(ENABLE_WEATHER)
642         pkg_check_modules_for_option(ENABLE_WEATHER "weather calendar" GWEATHER gweather-3.0>=${gweather_minimum_version})
643 endif(ENABLE_WEATHER)
645 # maps in Contacts preview
647 add_printable_option(ENABLE_CONTACT_MAPS "Enable contact maps" OFF)
649 if(ENABLE_CONTACT_MAPS)
650         pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" CHAMPLAIN champlain-gtk-0.12>=${champlain_minimum_version})
651         pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" GEO geocode-glib-1.0>=${geocode_glib_minimum_version})
652         pkg_check_modules_for_option(ENABLE_CONTACT_MAPS "contact maps" CLUTTER_GTK clutter-gtk-1.0>=${clutter_gtk_minimum_version})
653 endif(ENABLE_CONTACT_MAPS)
655 # pst-import plugin
657 add_printable_option(ENABLE_PST_IMPORT "Enable pst-import plugin" ON)
659 if(ENABLE_PST_IMPORT)
660         pkg_check_modules_for_option(ENABLE_PST_IMPORT "pst-import plugin" LIBPST libpst>=${libpst_minimum_version})
661         list(APPEND plugins_standard pst-import)
662 endif(ENABLE_PST_IMPORT)
664 # Finish plugins build setup
665 set(build_plugins)
667 if(ENABLE_PLUGINS STREQUAL "" OR ENABLE_PLUGINS STREQUAL "all")
668         set(build_plugins ${plugins_base} ${plugins_standard})
669 elseif(ENABLE_PLUGINS STREQUAL "base")
670         set(build_plugins ${plugins_base})
671 elseif(NOT ENABLE_PLUGINS STREQUAL "no")
672         message(FATAL_ERROR "Incorrect value for ENABLE_PLUGINS (${ENABLE_PLUGINS}), use either \"no\", or \"base\" or \"all\" value")
673 endif()
675 # ******************************
676 # Glade catalog
677 # ******************************
679 add_printable_option(WITH_GLADE_CATALOG "Install the catalog files for Glade 3 (for maintainers only)" OFF)
681 if(WITH_GLADE_CATALOG)
682         pkg_check_modules_for_option(WITH_GLADE_CATALOG "Glade 3 catalog files" GLADEUI gladeui-2.0>=${gladeui_minimum_version})
683 endif(WITH_GLADE_CATALOG)
685 # Generate the ${PROJECT_NAME}-config.h file
686 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config.h)
688 print_build_options()
690 # The shell_private_requirements is used by the evolution-shell.pc.in
691 if(ENABLE_GNOME_DESKTOP)
692         set(shell_private_requirements "Requires.private: ${GNOME_DESKTOP_DEPENDENCY}")
693 else(ENABLE_GNOME_DESKTOP)
694         set(shell_private_requirements "")
695 endif(ENABLE_GNOME_DESKTOP)
697 # The shell_privlibdir_rpath_flags is used by the evolution-shell.pc.in
698 # and if set, then should be preceded with a space.
699 if(NOT WIN32)
700         set(shell_privlibdir_rpath_flags  " -Wl,-R${privlibdir}")
701 endif(NOT WIN32)
703 add_pkgconfig_file(evolution-calendar.pc.in evolution-calendar-${INTERFACE_VERSION}.pc)
704 add_pkgconfig_file(evolution-mail.pc.in evolution-mail-${INTERFACE_VERSION}.pc)
705 add_pkgconfig_file(evolution-shell.pc.in evolution-shell-${INTERFACE_VERSION}.pc)
707 add_appdata_file(evolution.appdata.xml.in evolution.appdata.xml)
709 add_subdirectory(data)
710 add_subdirectory(po)
711 add_subdirectory(src)
712 add_subdirectory(tests)
714 if(ENABLE_GTK_DOC)
715         add_subdirectory(docs)
716 endif(ENABLE_GTK_DOC)
718 if(WITH_HELP)
719         add_subdirectory(help)
720 endif(WITH_HELP)