[evolution-mapi] Convert from autotools to CMake



commit 16af933bb8b4b255423b65addcd3701c65e71373
Author: Milan Crha <mcrha redhat com>
Date:   Mon Oct 10 15:44:59 2016 +0200

    Convert from autotools to CMake

 .gitignore                                         |    3 +
 CMakeLists.txt                                     |  190 ++++++++++++
 Makefile.am                                        |   37 ---
 acinclude.m4                                       |   62 ----
 autogen.sh                                         |   41 ---
 cmake/cmake_uninstall.cmake.in                     |   21 ++
 cmake/modules/CheckTarget.cmake                    |   21 ++
 cmake/modules/CodeCoverageGCOV.cmake               |   45 +++
 cmake/modules/DistTargets.cmake                    |   87 ++++++
 cmake/modules/EvolutionMacros.cmake                |   63 ++++
 cmake/modules/FindIntltool.cmake                   |  209 +++++++++++++
 cmake/modules/GLibTools.cmake                      |  277 ++++++++++++++++++
 cmake/modules/PkgConfigEx.cmake                    |   90 ++++++
 cmake/modules/PrintableOptions.cmake               |   74 +++++
 cmake/modules/SetupBuildFlags.cmake                |   80 +++++
 cmake/modules/UninstallTarget.cmake                |   13 +
 cmake/verify-news-file.sh                          |   56 ++++
 config.h.in                                        |   22 ++
 configure.ac                                       |  307 --------------------
 git.mk                                             |  224 --------------
 po/CMakeLists.txt                                  |    1 +
 src/CMakeLists.txt                                 |   67 +++++
 src/Makefile.am                                    |    3 -
 src/addressbook/CMakeLists.txt                     |   62 ++++
 src/addressbook/Makefile.am                        |   33 --
 src/addressbook/e-book-backend-mapi-contacts.c     |    4 +-
 src/addressbook/e-book-backend-mapi-factory.c      |    4 +-
 src/addressbook/e-book-backend-mapi-gal.c          |    4 +-
 src/addressbook/e-book-backend-mapi.c              |    4 +-
 src/calendar/CMakeLists.txt                        |   56 ++++
 src/calendar/Makefile.am                           |   32 --
 src/calendar/e-cal-backend-mapi-factory.c          |    4 +-
 src/calendar/e-cal-backend-mapi.c                  |    4 +-
 src/camel/CMakeLists.txt                           |  130 +++++++++
 src/camel/Makefile.am                              |   46 ---
 src/camel/camel-mapi-folder-summary.c              |    4 +-
 src/camel/camel-mapi-folder.c                      |    4 +-
 src/camel/camel-mapi-provider.c                    |    4 +-
 src/camel/camel-mapi-sasl-krb.c                    |    4 +-
 src/camel/camel-mapi-store-summary.c               |    4 +-
 src/camel/camel-mapi-store.c                       |    4 +-
 src/camel/camel-mapi-transport.c                   |    4 +-
 src/collection/CMakeLists.txt                      |   22 ++
 src/collection/Makefile.am                         |   37 ---
 src/collection/e-mapi-backend.c                    |    4 +-
 src/collection/module-mapi-backend.c               |    4 +-
 src/configuration/CMakeLists.txt                   |   57 ++++
 src/configuration/Makefile.am                      |   60 ----
 src/configuration/e-book-config-mapi.c             |    4 +-
 src/configuration/e-book-config-mapigal.c          |    4 +-
 src/configuration/e-cal-config-mapi.c              |    4 +-
 src/configuration/e-mail-config-mapi-backend.c     |    4 +-
 src/configuration/e-mail-config-mapi-extension.c   |    4 +-
 src/configuration/e-mail-config-mapi-page.c        |    4 +-
 src/configuration/e-mapi-config-ui-extension.c     |    4 +-
 src/configuration/e-mapi-config-utils.c            |    4 +-
 src/configuration/e-mapi-edit-folder-permissions.c |    4 +-
 src/configuration/e-mapi-search-gal-user.c         |    4 +-
 .../e-mapi-subscribe-foreign-folder.c              |    4 +-
 src/configuration/module-mapi-configuration.c      |    4 +-
 src/libexchangemapi/CMakeLists.txt                 |   81 +++++
 src/libexchangemapi/Makefile.am                    |   84 ------
 src/libexchangemapi/e-mapi-book-utils.c            |    4 +-
 src/libexchangemapi/e-mapi-cal-recur-utils.c       |    4 +-
 src/libexchangemapi/e-mapi-cal-tz-utils.c          |    4 +-
 src/libexchangemapi/e-mapi-cal-utils.c             |    4 +-
 src/libexchangemapi/e-mapi-connection.c            |    4 +-
 src/libexchangemapi/e-mapi-fast-transfer.c         |    4 +-
 src/libexchangemapi/e-mapi-folder.c                |    4 +-
 src/libexchangemapi/e-mapi-mail-utils.c            |    4 +-
 src/libexchangemapi/e-mapi-mail-utils.h            |    4 +-
 src/libexchangemapi/e-mapi-operation-queue.c       |    4 +-
 src/libexchangemapi/e-mapi-utils.c                 |    4 +-
 src/libexchangemapi/libexchangemapi.pc.in          |   15 -
 74 files changed, 1765 insertions(+), 1095 deletions(-)
---
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e449d05
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+build
+_build
+.build
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..5884b07
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,190 @@
+# Evolution-MAPI build script
+
+cmake_minimum_required(VERSION 3.0)
+cmake_policy(VERSION 3.0)
+
+project(evolution-mapi
+       VERSION 3.23.1
+       LANGUAGES C CXX)
+set(PROJECT_BUGREPORT "http://bugzilla.gnome.org/enter_bug.cgi?product=evolution-mapi";)
+
+# Required for FindIntltool module
+set(GETTEXT_PACKAGE ${PROJECT_NAME})
+set(GETTEXT_PO_DIR ${CMAKE_SOURCE_DIR}/po)
+
+# Required for 'disttest' and 'ditcheck' of DistTarget module
+set(PROJECT_DISTCONFIGURE_PARAMS)
+
+# Keep these two definitions in agreement.
+set(glib_minimum_version 2.46)
+set(glib_encoded_version GLIB_VERSION_2_46)
+
+# Keep these two definitions in agreement.
+set(gdk_minimum_version 3.10)
+set(gdk_encoded_version GDK_VERSION_3_10)
+
+# Warn about API usage that violates our minimum requirements.
+add_definitions(-DGLIB_VERSION_MAX_ALLOWED=${glib_encoded_version})
+add_definitions(-DGDK_VERSION_MAX_ALLOWED=${gdk_encoded_version})
+
+# These will suppress warnings about newly-deprecated symbols. Ideally
+# these settings should match our minimum requirements and we will clean
+# up any new deprecation warnings after bumping our minimum requirements.
+# But if the warnings get to be overwhelming, use fixed versions instead.
+add_definitions(-DGLIB_VERSION_MIN_REQUIRED=${glib_encoded_version})
+add_definitions(-DGDK_VERSION_MIN_REQUIRED=${gdk_encoded_version})
+
+set(eds_minimum_version ${PROJECT_VERSION})
+set(evo_minimum_version ${PROJECT_VERSION})
+set(libmapi_minimum_version 2.0)
+
+# Load modules from the source tree
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+set(CMAKE_SKIP_BUILD_RPATH OFF)
+set(CMAKE_BUILD_WITH_INSTALL_RPATH OFF)
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
+# CMAKE_INSTALL_RPATH is set below
+
+# CMake modules
+include(CheckCSourceCompiles)
+
+# Project custom modules
+include(PrintableOptions)
+
+add_printable_variable(LIB_SUFFIX "Library directory suffix, usually defined to '64' for x86_64 systems" "")
+add_printable_variable_bare(CMAKE_INSTALL_PREFIX)
+add_printable_variable_path(BIN_INSTALL_DIR "Install directory for binary files, defaults to 
CMAKE_INSTALL_PREFIX/bin" "${CMAKE_INSTALL_PREFIX}/bin")
+add_printable_variable_path(INCLUDE_INSTALL_DIR "Install directory for header files, defaults to 
CMAKE_INSTALL_PREFIX/include" "${CMAKE_INSTALL_PREFIX}/include")
+add_printable_variable_path(LIB_INSTALL_DIR "Install directory for library files, defaults to 
CMAKE_INSTALL_PREFIX/lib{LIB_SUFFIX}" "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
+add_printable_variable_path(LIBEXEC_INSTALL_DIR "Install directory for library executable files, defaults to 
CMAKE_INSTALL_PREFIX/libexec" "${CMAKE_INSTALL_PREFIX}/libexec")
+add_printable_variable_path(SHARE_INSTALL_DIR "Install directory for shared files, defaults to 
CMAKE_INSTALL_PREFIX/share" "${CMAKE_INSTALL_PREFIX}/share")
+add_printable_variable_path(LOCALE_INSTALL_DIR "Install directory for locale files, defaults to 
SHARE_INSTALL_DIR/locale" "${SHARE_INSTALL_DIR}/locale")
+add_printable_variable_path(SYSCONF_INSTALL_DIR "Install directory for system configuration files, defaults 
to CMAKE_INSTALL_PREFIX/etc" "${CMAKE_INSTALL_PREFIX}/etc")
+
+# ******************************
+# Dependencies
+# ******************************
+
+include(CodeCoverageGCOV)
+include(CheckTarget)
+include(DistTargets)
+include(EvolutionMacros)
+include(GLibTools)
+include(PkgConfigEx)
+include(SetupBuildFlags)
+include(UninstallTarget)
+
+include(FindIntltool)
+
+add_printable_option(ENABLE_MAINTAINER_MODE "Enable maintainer mode" OFF)
+
+if(ENABLE_MAINTAINER_MODE)
+       set(BUILD_TESTING ON)
+endif(ENABLE_MAINTAINER_MODE)
+
+# Setup compiler/linker flags
+setup_build_flags(${ENABLE_MAINTAINER_MODE})
+
+if(${ENABLE_MAINTAINER_MODE})
+       add_definitions(-DEDS_DISABLE_DEPRECATED=1)
+endif(${ENABLE_MAINTAINER_MODE})
+
+pkg_check_modules(CAMEL camel-1.2>=${eds_minimum_version})
+pkg_check_modules(EVOLUTION_DATA_SERVER evolution-data-server-1.2>=${eds_minimum_version})
+pkg_check_modules(LIBEBACKEND libebackend-1.2>=${eds_minimum_version})
+pkg_check_modules(LIBEBOOK libebook-1.2>=${eds_minimum_version})
+pkg_check_modules(LIBECAL libecal-1.2>=${eds_minimum_version})
+pkg_check_modules(LIBEDATABOOK libedata-book-1.2>=${eds_minimum_version})
+pkg_check_modules(LIBEDATACAL libedata-cal-1.2>=${eds_minimum_version})
+pkg_check_modules(LIBEDATASERVER libedataserver-1.2>=${eds_minimum_version})
+
+pkg_check_modules(EVOLUTION_SHELL evolution-shell-3.0>=${evo_minimum_version})
+pkg_check_modules(EVOLUTION_MAIL evolution-mail-3.0>=${evo_minimum_version})
+
+pkg_check_modules(GNOME_PLATFORM
+       glib-2.0>=${glib_minimum_version}
+       gtk+-3.0>=${gdk_minimum_version}
+)
+
+pkg_check_modules(LIBICAL libical)
+pkg_check_modules(LIBMAPI libmapi>=${libmapi_minimum_version})
+
+set(CMAKE_REQUIRED_FLAGS ${LIBMAPI_INCLUDE_CFLAGS})
+set(CMAKE_REQUIRED_INCLUDES ${LIBMAPI_INCLUDE_DIRS})
+set(CMAKE_REQUIRED_LIBRARIES ${LIBMAPI_LDFLAGS})
+
+# ******************************
+# struct mapi_SNotRestriction availability
+# see http://tracker.openchange.org/issues/377
+# ******************************
+
+CHECK_C_SOURCE_COMPILES("#include <libmapi/libmapi.h>
+                       int main(void) { struct mapi_SNotRestriction snot; snot.res->rt = RES_NOT; return 0; 
}" HAVE_RES_NOT_SUPPORTED)
+
+# ******************************
+# OpenChange 2.1 fast-transfer tags availability
+# ******************************
+
+CHECK_C_SOURCE_COMPILES("#include <libmapi/libmapi.h>
+                       int main(void) { uint32_t tag;
+                               tag = StartMessage;
+                               tag = EndMessage;
+                               tag = StartRecip;
+                               tag = EndToRecip;
+                               tag = NewAttach;
+                               tag = EndAttach;
+                               tag = StartEmbed;
+                               tag = EndEmbed; return 0; }" HAVE_FAST_TRANSFER_TAGS_2_1)
+
+# ******************************
+# OpenChange 2.3 QueryRows
+# ******************************
+
+CHECK_C_SOURCE_COMPILES("#include <libmapi/libmapi.h>
+                       int main(void) { QueryRows(NULL, 1, TBL_ADVANCE, TBL_FORWARD_READ, NULL); return 0; 
}" HAVE_QUERYROWS_FORWARDREAD)
+
+unset(CMAKE_REQUIRED_FLAGS)
+unset(CMAKE_REQUIRED_INCLUDES)
+unset(CMAKE_REQUIRED_LIBRARIES)
+
+# ******************************
+# Special directories
+# ******************************
+
+set(privlibdir "${LIB_INSTALL_DIR}/${PROJECT_NAME}")
+
+pkg_check_variable(errordir evolution-shell-3.0 errordir)
+pkg_check_variable(evo_privlibdir evolution-shell-3.0 privlibdir)
+pkg_check_variable(camel_providerdir camel-1.2 camel_providerdir)
+pkg_check_variable(ebook_backenddir libedata-book-1.2 backenddir)
+pkg_check_variable(ecal_backenddir libedata-cal-1.2 backenddir)
+pkg_check_variable(eds_moduledir libebackend-1.2 moduledir)
+pkg_check_variable(evo_moduledir evolution-shell-3.0 moduledir)
+pkg_check_variable(mapidatadir evolution-data-server-1.2 privdatadir)
+pkg_check_variable(libmapi_ldif_dir libmapi datadir)
+
+set(mapidatadir "${mapidatadir}/mapi")
+set(libmapi_ldif_dir "${libmapi_ldif_dir}/setup")
+
+SET(CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}:${privlibdir}:${evo_privlibdir}")
+
+if(WIN32)
+       # On Win32 there is no "rpath" mechanism. We install the private
+       # shared libraries in $libdir, meaning the DLLs will actually be in
+       # $bindir. This means just having $bindir in PATH will be enough.
+       set(privsolibdir "${LIB_INSTALL_DIR}")
+else(WIN32)
+       set(privsolibdir "${privlibdir}")
+endif(WIN32)
+
+# Generate the ${PROJECT_NAME}-config.h file
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/${PROJECT_NAME}-config.h)
+
+print_build_options()
+
+add_appdata_file(evolution-mapi.metainfo.xml.in evolution-mapi.metainfo.xml)
+
+add_subdirectory(po)
+add_subdirectory(src)
diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in
new file mode 100644
index 0000000..2037e36
--- /dev/null
+++ b/cmake/cmake_uninstall.cmake.in
@@ -0,0 +1,21 @@
+if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+  message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+foreach(file ${files})
+  message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
+  if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+    exec_program(
+      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+      OUTPUT_VARIABLE rm_out
+      RETURN_VALUE rm_retval
+      )
+    if(NOT "${rm_retval}" STREQUAL 0)
+      message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
+    endif(NOT "${rm_retval}" STREQUAL 0)
+  else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+    message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
+  endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+endforeach(file)
diff --git a/cmake/modules/CheckTarget.cmake b/cmake/modules/CheckTarget.cmake
new file mode 100644
index 0000000..71824a9
--- /dev/null
+++ b/cmake/modules/CheckTarget.cmake
@@ -0,0 +1,21 @@
+# CheckTarget.cmake
+#
+# Defines a custom target 'check', which gathers test programs like 'make check'
+# This is taken from https://cmake.org/Wiki/CMakeEmulateMakeCheck
+#
+# What you do is to call command:
+# add_check_test(_name)
+#   where _name is the name of the test, as defined by add_executable().
+#   Note it is a good idea to use EXCLUDE_FROM_ALL within the add_executable().
+
+include(CTest)
+
+# Disable this to not have verbose tests
+set(CMAKE_CTEST_COMMAND ${CMAKE_CTEST_COMMAND} -V)
+
+add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
+
+macro(add_check_test _name)
+       add_test(NAME ${_name} COMMAND ${_name})
+       add_dependencies(check ${_name})
+endmacro(add_check_test)
diff --git a/cmake/modules/CodeCoverageGCOV.cmake b/cmake/modules/CodeCoverageGCOV.cmake
new file mode 100644
index 0000000..bf670e0
--- /dev/null
+++ b/cmake/modules/CodeCoverageGCOV.cmake
@@ -0,0 +1,45 @@
+# CodeCoverageGCOV.cmake
+#
+# Adds options ENABLE_CODE_COVERAGE, which builds the project with
+# code coverage support
+#
+# It sets variables:
+# CODE_COVERAGE_DEFINES - to be used with target_compile_definitions() and similar
+# CODE_COVERAGE_CFLAGS - to be used with target_compile_options() and similar for C code
+# CODE_COVERAGE_CXXFLAGS - to be used with target_compile_options() and similar for C++ code
+# CODE_COVERAGE_LDFLAGS - to be used with target_link_libraries() and similar
+#
+# These variables should be added as the last in the options, because they change compilation
+
+include(CheckLibraryExists)
+include(PrintableOptions)
+
+add_printable_option(ENABLE_CODE_COVERAGE "Enable build with GCOV code coverage" OFF)
+
+if(ENABLE_CODE_COVERAGE)
+       if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
+               CHECK_LIBRARY_EXISTS("gcov" "gcov_exit" "" HAVE_GCOV_LIBRARY)
+               if(HAVE_GCOV_LIBRARY)
+                       set(CODE_COVERAGE_CFLAGS "-O0 -g -fprofile-arcs -ftest-coverage")
+                       set(CODE_COVERAGE_LDFLAGS "-lgcov")
+
+                       add_definitions(-DNDEBUG)
+                       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CODE_COVERAGE_CFLAGS}")
+                       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CODE_COVERAGE_CFLAGS}")
+                       set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CODE_COVERAGE_LDFLAGS}")
+                       set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CODE_COVERAGE_LDFLAGS}")
+                       set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CODE_COVERAGE_LDFLAGS}")
+                       set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${CODE_COVERAGE_LDFLAGS}")
+               else(HAVE_GCOV_LIBRARY)
+                       message(FATAL_ERROR "Cannot fing gcov library, use -DENABLE_CODE_COVERAGE=OFF disable 
it")
+               endif(HAVE_GCOV_LIBRARY)
+
+       else("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
+               message(FATAL_ERROR "Code coverage requires gcc compiler, use -DENABLE_CODE_COVERAGE=OFF 
disable it")
+       endif("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
+else(ENABLE_CODE_COVERAGE)
+       set(CODE_COVERAGE_DEFINES "")
+       set(CODE_COVERAGE_CFLAGS "")
+       set(CODE_COVERAGE_CXXFLAGS "")
+       set(CODE_COVERAGE_LDFLAGS "")
+endif(ENABLE_CODE_COVERAGE)
diff --git a/cmake/modules/DistTargets.cmake b/cmake/modules/DistTargets.cmake
new file mode 100644
index 0000000..2551d3a
--- /dev/null
+++ b/cmake/modules/DistTargets.cmake
@@ -0,0 +1,87 @@
+# DistTarget.cmake
+#
+# Defines custom targets related to distributing source code.
+# It requires to have populated 'PROJECT_NAME' and 'PROJECT_VERSION' variables,
+# possibly through the project() command. It also uses 'PROJECT_DISTCONFIGURE_PARAMS'
+# variable when configuring the unpacked distribution.
+#
+# Added targets:
+# dist - only creates a tarball
+# disttest - creates a tarball and 'make && make install' it to a temporary prefix
+#    to verify that the code can be built and installed; it also verifies
+#    that the first line of the NEWS file contains the same version as
+#    the tarball and that it claims today's date.
+# distcheck - similar to 'disttest', only runs also 'make check' before installing
+
+# Filenames for tarball
+set(ARCHIVE_BASE_NAME ${PROJECT_NAME}-${PROJECT_VERSION})
+set(ARCHIVE_FULL_NAME ${ARCHIVE_BASE_NAME}.tar.xz)
+
+add_custom_target(dist
+       COMMAND ${CMAKE_COMMAND} -E echo "Creating '${ARCHIVE_FULL_NAME}'..."
+       COMMAND git archive --prefix=${ARCHIVE_BASE_NAME}/ HEAD | xz -z > 
${CMAKE_BINARY_DIR}/${ARCHIVE_FULL_NAME}
+       COMMAND ${CMAKE_COMMAND} -E echo "Distribution tarball '${ARCHIVE_FULL_NAME}' created at 
${CMAKE_BINARY_DIR}"
+       WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+)
+
+set(disttest_extract_dir "${CMAKE_BINARY_DIR}/${ARCHIVE_BASE_NAME}")
+set(disttest_build_dir "${disttest_extract_dir}/_build")
+set(disttest_install_dir "${disttest_extract_dir}/_install")
+
+add_custom_command(OUTPUT ${disttest_build_dir}/Makefile
+       # remove any left-over directory
+       COMMAND ${CMAKE_COMMAND} -E remove_directory ${disttest_extract_dir}
+
+       # extract the tarball
+       COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR} tar -xf ${ARCHIVE_FULL_NAME}
+
+       # verify the NEWS file contains what it should contain
+       COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}
+               bash ${CMAKE_SOURCE_DIR}/cmake/verify-news-file.sh "${disttest_extract_dir}/NEWS" 
"${PROJECT_VERSION}"
+
+       # create a _build sub-directory
+       COMMAND ${CMAKE_COMMAND} -E make_directory "${disttest_build_dir}"
+
+       # configure the project with PROJECT_DISTCHECK_PARAMS
+       COMMAND ${CMAKE_COMMAND} -E chdir "${disttest_build_dir}"
+               ${CMAKE_COMMAND} -G "Unix Makefiles"
+                       ${PROJECT_DISTCONFIGURE_PARAMS}
+                       -DCMAKE_BUILD_TYPE=Release
+                       -DCMAKE_INSTALL_PREFIX="${disttest_install_dir}"
+                       ..
+
+       # 'make' the project
+       COMMAND ${CMAKE_COMMAND} -E chdir ${disttest_build_dir} make -j
+
+       DEPENDS dist
+       COMMENT "Building from distribution tarball ${ARCHIVE_FULL_NAME}..."
+)
+
+add_custom_target(distcheck
+       # 'make check' the project
+       COMMAND ${CMAKE_COMMAND} -E chdir ${disttest_build_dir} make -j check
+
+       # 'make install' the project
+       COMMAND ${CMAKE_COMMAND} -E chdir ${disttest_build_dir} make -j install
+
+       # if we get this far, then everything worked, thus clean up
+       COMMAND ${CMAKE_COMMAND} -E remove_directory ${disttest_extract_dir}
+
+       # and show the good news
+       COMMAND ${CMAKE_COMMAND} -E echo "distcheck of '${ARCHIVE_FULL_NAME}' succeeded"
+
+       DEPENDS ${disttest_build_dir}/Makefile
+)
+
+add_custom_target(disttest
+       # 'make install' the project
+       COMMAND ${CMAKE_COMMAND} -E chdir ${disttest_build_dir} make -j install
+
+       # if we get this far, then everything worked, thus clean up
+       COMMAND ${CMAKE_COMMAND} -E remove_directory ${disttest_extract_dir}
+
+       # and show the good news
+       COMMAND ${CMAKE_COMMAND} -E echo "disttest of '${ARCHIVE_FULL_NAME}' succeeded"
+
+       DEPENDS ${disttest_build_dir}/Makefile
+)
diff --git a/cmake/modules/EvolutionMacros.cmake b/cmake/modules/EvolutionMacros.cmake
new file mode 100644
index 0000000..0491e13
--- /dev/null
+++ b/cmake/modules/EvolutionMacros.cmake
@@ -0,0 +1,63 @@
+# EvolutionMacros.cmake
+#
+# Utility macros for evolution-related files
+#
+# add_error_files(_part _file0)
+#    Adds build and install rules to create .error files from .error.xml
+#    files in the current source directory. The _file0 is expected to be
+#    without the .xml extension. The macro can receive one or more error
+#    files. There is created a custom "${_part}-error-files" target.
+#
+# add_eplug_file(_part _eplug_filename)
+#    Adds build and install rules to create .eplug files from .eplug.xml
+#    files in the current source directory. The _eplug_filename is expected
+#    to be without the .xml extension. The macro can receive exactly one
+#    eplug file. There is created a custom "${_part}-eplug-file" target.
+
+include(FindIntltool)
+
+macro(add_custom_xml_files _part _destination _targetsuffix _ext _mergeparam _file0)
+       set(filedeps)
+
+       foreach(file ${_file0} ${ARGN})
+               intltool_merge(${file}${_ext} ${file} --xml-style --utf8 ${_mergeparam})
+
+               get_filename_component(_path ${file} DIRECTORY)
+               if(_path STREQUAL "")
+                       set(builtfile ${CMAKE_CURRENT_BINARY_DIR}/${file})
+               else(_path STREQUAL "")
+                       set(builtfile ${file})
+               endif(_path STREQUAL "")
+
+               install(FILES ${builtfile}
+                       DESTINATION ${_destination}
+               )
+
+               list(APPEND filedeps ${builtfile})
+       endforeach(file)
+
+       add_custom_target(${_part}-${_targetsuffix}-files ALL
+               DEPENDS ${filedeps}
+       )
+endmacro(add_custom_xml_files)
+
+macro(add_error_files _part _file0)
+       add_custom_xml_files(${_part} ${errordir} error .xml --no-translations ${_file0} ${ARGN})
+endmacro(add_error_files)
+
+macro(add_eplug_file _part _eplug_filename)
+       set(PLUGINDIR "${plugindir}")
+       set(SOEXT "${CMAKE_SHARED_MODULE_SUFFIX}")
+       set(LOCALEDIR "${LOCALE_INSTALL_DIR}")
+
+       configure_file(${_eplug_filename}.xml
+               ${CMAKE_CURRENT_BINARY_DIR}/${_eplug_filename}.in
+               @ONLY
+       )
+
+       unset(PLUGINDIR)
+       unset(SOEXT)
+       unset(LOCALEDIR)
+
+       add_custom_xml_files(${_part} ${plugindir} plugin .in --no-translations 
${CMAKE_CURRENT_BINARY_DIR}/${_eplug_filename})
+endmacro(add_eplug_file)
diff --git a/cmake/modules/FindIntltool.cmake b/cmake/modules/FindIntltool.cmake
new file mode 100644
index 0000000..f6f27fe
--- /dev/null
+++ b/cmake/modules/FindIntltool.cmake
@@ -0,0 +1,209 @@
+# FindIntltool.cmake
+#
+# Searches for intltool and gettext. It aborts, if anything cannot be found.
+# Requires GETTEXT_PO_DIR to be set to full path of the po/ directory.
+#
+# Output is:
+#   INTLTOOL_UPDATE  - an intltool-update executable path, as found
+#   INTLTOOL_EXTRACT  - an intltool-extract executable path, as found
+#   INTLTOOL_MERGE  - an intltool-merge executable path, as found
+#
+# and anything from the FindGettext module.
+#
+# The below provided macros require GETTEXT_PACKAGE to be set.
+#
+# intltool_add_check_potfiles_target()
+#    Adds a check-potfiles target, which verifies that all files with translations
+#    are added in the POTFILES.in file inside GETTEXT_PO_DIR. This macro can be called
+#    only inside GETTEXT_PO_DIR.
+#
+# intltool_add_pot_file_target()
+#    Creates a new target pot-file, which generates ${GETTEXT_PACKAGE}.pot file into
+#    the CMAKE_CURERNT_BINARY_DIR. This target is not part of ALL.
+#    This can be called only inside GETTEXT_PO_DIR.
+#
+# intltool_process_po_files()
+#    Processes all files in the GETTEXT_PO_DIR and generates .gmo files for them
+#    in CMAKE_CURRENT_BINARY_DIR. These are added into a new target gmo-files.
+#    It also installs them into proper location under LOCALE_INSTALL_DIR.
+#    This can be called only inside GETTEXT_PO_DIR.
+#
+# intltool_setup_po_dir()
+#    Shortcut to setup intltool's po/ directory by adding all custom targets
+#    and such. this can be called only inside GETTEXT_PO_DIR.
+#
+# intltool_merge(_in_filename _out_filename ...args)
+#    Adds rule to call intltool-merge. The args are optional arguments.
+#    This can be called in any folder, only the GETTEXT_PO_DIR should
+#    be properly set, otherwise the call will fail.
+#
+# add_appdata_file(_infilename _outfilename)
+#    A shortcut to call intltool-merge() for an appdata file and install it
+#    to ${SHARE_INSTALL_DIR}/appdata
+
+include(FindGettext)
+
+if(NOT GETTEXT_FOUND)
+       message(FATAL_ERROR "gettext not found, please install at least 0.18.3 version")
+endif(NOT GETTEXT_FOUND)
+
+if(NOT GETTEXT_FOUND)
+       message(FATAL_ERROR "gettext not found, please install at least 0.18.3 version")
+endif(NOT GETTEXT_FOUND)
+
+if(GETTEXT_VERSION_STRING VERSION_LESS "0.18.3")
+       message(FATAL_ERROR "gettext version 0.18.3+ required, but version '${GETTEXT_VERSION_STRING}' found 
instead. Please update your gettext")
+endif(GETTEXT_VERSION_STRING VERSION_LESS "0.18.3")
+
+find_program(XGETTEXT xgettext)
+if(NOT XGETTEXT)
+       message(FATAL_ERROR "xgettext executable not found. Please install or update your gettext to at least 
0.18.3 version")
+endif(NOT XGETTEXT)
+
+find_program(INTLTOOL_UPDATE intltool-update)
+if(NOT INTLTOOL_UPDATE)
+       message(FATAL_ERROR "intltool-update not found. Please install it (usually part of an 'intltool' 
package)")
+endif(NOT INTLTOOL_UPDATE)
+
+find_program(INTLTOOL_EXTRACT intltool-extract)
+if(NOT INTLTOOL_EXTRACT)
+       message(FATAL_ERROR "intltool-extract not found. Please install it (usually part of an 'intltool' 
package)")
+endif(NOT INTLTOOL_EXTRACT)
+
+find_program(INTLTOOL_MERGE intltool-merge)
+if(NOT INTLTOOL_MERGE)
+       message(FATAL_ERROR "intltool-merge not found. Please install it (usually part of an 'intltool' 
package)")
+endif(NOT INTLTOOL_MERGE)
+
+macro(intltool_add_check_potfiles_target)
+       if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL GETTEXT_PO_DIR)
+               message(FATAL_ERROR "intltool_add_pot_file_target() can be called only inside GETTEXT_PO_DIR 
('${GETTEXT_PO_DIR}'), but it is called inside '${CMAKE_CURRENT_SOURCE_DIR}' instead")
+       endif(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL GETTEXT_PO_DIR)
+
+       add_custom_target(check-potfiles
+               COMMAND ${INTLTOOL_UPDATE} -m
+               WORKING_DIRECTORY ${GETTEXT_PO_DIR}
+       )
+endmacro(intltool_add_check_potfiles_target)
+
+macro(intltool_add_pot_file_target)
+       if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL GETTEXT_PO_DIR)
+               message(FATAL_ERROR "intltool_add_pot_file_target() can be called only inside GETTEXT_PO_DIR 
('${GETTEXT_PO_DIR}'), but it is called inside '${CMAKE_CURRENT_SOURCE_DIR}' instead")
+       endif(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL GETTEXT_PO_DIR)
+
+       add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${GETTEXT_PACKAGE}.pot
+               COMMAND ${CMAKE_COMMAND} -E env INTLTOOL_EXTRACT="${INTLTOOL_EXTRACT}" XGETTEXT="${XGETTEXT}" 
srcdir=${CMAKE_CURRENT_SOURCE_DIR} ${INTLTOOL_UPDATE} --gettext-package ${GETTEXT_PACKAGE} --pot
+       )
+
+       add_custom_target(pot-file
+               DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GETTEXT_PACKAGE}.pot
+       )
+endmacro(intltool_add_pot_file_target)
+
+macro(intltool_process_po_files)
+       if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL GETTEXT_PO_DIR)
+               message(FATAL_ERROR "intltool_process_po_files() can be called only inside GETTEXT_PO_DIR 
('${GETTEXT_PO_DIR}'), but it is called inside '${CMAKE_CURRENT_SOURCE_DIR}' instead")
+       endif(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL GETTEXT_PO_DIR)
+
+       file(GLOB po_files ${GETTEXT_PO_DIR}/*.po)
+
+       set(LINGUAS)
+       set(LINGUAS_GMO)
+
+       foreach(file IN LISTS po_files)
+               get_filename_component(lang ${file} NAME_WE)
+               list(APPEND LINGUAS ${lang})
+               list(APPEND LINGUAS_GMO ${lang}.gmo)
+
+               add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo
+                       COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo 
${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po
+                       DEPENDS ${lang}.po
+               )
+
+               install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo
+                       DESTINATION ${LOCALE_INSTALL_DIR}/${lang}/LC_MESSAGES/
+                       RENAME ${GETTEXT_PACKAGE}.mo
+               )
+               if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo.m)
+                       install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo.m
+                               DESTINATION ${LOCALE_INSTALL_DIR}/${lang}/LC_MESSAGES/
+                               RENAME ${GETTEXT_PACKAGE}.mo.m
+                       )
+               endif(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${lang}.gmo.m)
+       endforeach(file)
+
+       add_custom_target(gmo-files ALL
+               DEPENDS ${LINGUAS_GMO}
+       )
+endmacro(intltool_process_po_files)
+
+macro(intltool_setup_po_dir)
+       if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL GETTEXT_PO_DIR)
+               message(FATAL_ERROR "intltool_setup_po_dir() can be called only inside GETTEXT_PO_DIR 
('${GETTEXT_PO_DIR}'), but it is called inside '${CMAKE_CURRENT_SOURCE_DIR}' instead")
+       endif(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL GETTEXT_PO_DIR)
+
+       intltool_add_check_potfiles_target()
+       intltool_add_pot_file_target()
+       intltool_process_po_files()
+endmacro(intltool_setup_po_dir)
+
+macro(intltool_merge _in_filename _out_filename)
+       set(_in ${_in_filename})
+       set(_out ${_out_filename})
+
+       get_filename_component(_path ${_in} DIRECTORY)
+       if(_path STREQUAL "")
+               set(_in ${CMAKE_CURRENT_SOURCE_DIR}/${_in})
+       endif(_path STREQUAL "")
+
+       get_filename_component(_path ${_out} DIRECTORY)
+       if(_path STREQUAL "")
+               set(_out ${CMAKE_CURRENT_BINARY_DIR}/${_out})
+       endif(_path STREQUAL "")
+
+       set(_has_no_translations OFF)
+       set(_args)
+       foreach(_arg ${ARGN})
+               list(APPEND _args "${_arg}")
+               if(_arg STREQUAL "--no-translations")
+                       set(_has_no_translations ON)
+               endif(_arg STREQUAL "--no-translations")
+       endforeach(_arg)
+
+       if(_has_no_translations)
+               add_custom_command(OUTPUT ${_out}
+                       COMMAND ${INTLTOOL_MERGE} ${_args} --quiet "${_in}" "${_out}"
+                       DEPENDS ${_in}
+               )
+       else(_has_no_translations)
+               add_custom_command(OUTPUT ${_out}
+                       COMMAND ${INTLTOOL_MERGE} ${_args} --quiet 
--cache="${CMAKE_BINARY_DIR}/po/.intltool-merge-cache" "${GETTEXT_PO_DIR}" "${_in}" "${_out}"
+                       DEPENDS ${_in}
+               )
+       endif(_has_no_translations)
+endmacro(intltool_merge)
+
+macro(add_appdata_file _infilename _outfilename)
+       if(NOT TARGET appdata-files)
+               add_custom_target(appdata-files ALL)
+       endif(NOT TARGET appdata-files)
+
+       set(_out ${_outfilename})
+       get_filename_component(_outtarget ${_out} NAME_WE)
+       get_filename_component(_path ${_out} DIRECTORY)
+       if(_path STREQUAL "")
+               set(_out ${CMAKE_CURRENT_BINARY_DIR}/${_out})
+       endif(_path STREQUAL "")
+
+       intltool_merge(${_infilename} ${_out} --xml-style --utf8)
+
+       add_custom_target(appdata-${_outtarget}
+               DEPENDS ${_out}
+       )
+
+       add_dependencies(appdata-files appdata-${_outtarget})
+
+       install(FILES ${_out}
+               DESTINATION ${SHARE_INSTALL_DIR}/appdata
+       )
+endmacro(add_appdata_file)
diff --git a/cmake/modules/GLibTools.cmake b/cmake/modules/GLibTools.cmake
new file mode 100644
index 0000000..ba05824
--- /dev/null
+++ b/cmake/modules/GLibTools.cmake
@@ -0,0 +1,277 @@
+# GLibTools.cmake
+#
+# Provides functions to run glib tools.
+#
+# Functions:
+#
+# glib_mkenums(_output_filename_noext _enums_header _define_name)
+#    runs glib-mkenums to generate enumtypes .h and .c files from _enums_header.
+#    It searches for files in the current source directory and exports to the current
+#    binary directory.
+#
+#    An example call is:
+#        glib_mkenums(camel-enumtypes camel-enums.h CAMEL_ENUMTYPES_H)
+#        which uses camel-enums.h as the source of known enums and generates
+#        camel-enumtypes.h which will use the CAMEL_ENUMTYPES_H define
+#        and also generates camel-enumtypes.c with the needed code.
+#
+# glib_genmarshal(_output_filename_noext _prefix _marshallist_filename)
+#    runs glib-genmarshal to process ${_marshallist_filename} to ${_output_filename_noext}.c
+#    and ${_output_filename_noext}.h files in the current binary directory, using
+#    the ${_prefix} as the function prefix.
+#
+# gdbus_codegen(_xml _interface_prefix _c_namespace _files_prefix _list_gens)
+#    runs gdbus-codegen to generate GDBus code from _xml file description,
+#    using _interface_prefix, _c_namespace and _files_prefix as arguments.
+#    The _list_gens is a list variable are stored expected generated files.
+#
+#    An example call is:
+#        set(GENERATED_DBUS_LOCALE
+#               e-dbus-localed.c
+#              e-dbus-localed.h
+#        )
+#        gdbus_codegen(org.freedesktop.locale1.xml org.freedesktop. E_DBus e-dbus-localed 
GENERATED_DBUS_LOCALE)
+#
+# gdbus_codegen_custom(_xml _interface_prefix _c_namespace _files_prefix _list_gens _args)
+#    The same as gdbus_codegen() except allows to pass other arguments to the call,
+#    like for example --c-generate-object-manager
+#
+# add_gsettings_schemas(_target _schema0 ...)
+#    Adds one or more GSettings schemas. The extension is supposed to be .gschema.xml. The schema file 
generation
+#    is added as a dependency of _target.
+#
+# glib_compile_resources _sourcedir _outputprefix _cname _inxml ...deps)
+#    Calls glib-compile-resources as defined in _inxml and using _outputprefix and_cname as other arguments
+#    beside _sourcedir. The optional arguments are other dependencies.
+
+include(PkgConfigEx)
+include(UninstallTarget)
+
+find_program(GLIB_MKENUMS glib-mkenums)
+if(NOT GLIB_MKENUMS)
+       message(FATAL_ERROR "Cannot find glib-mkenums, which is required to build ${PROJECT_NAME}")
+endif(NOT GLIB_MKENUMS)
+
+function(glib_mkenums _output_filename_noext _enums_header _define_name)
+       set(HEADER_TMPL "
+/*** BEGIN file-header ***/
+#ifndef ${_define_name}
+#define ${_define_name}
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* Enumerations from \"@filename@\" */
+
+/*** END file-production ***/
+
+/*** BEGIN enumeration-production ***/
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@  (@enum_name@_get_type())
+GType @enum_name@_get_type     (void) G_GNUC_CONST;
+
+/*** END enumeration-production ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* ${_define_name} */
+/*** END file-tail ***/")
+
+       file(WRITE 
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/enumtypes-${_output_filename_noext}.h.tmpl" 
"${HEADER_TMPL}\n")
+
+       add_custom_command(
+               OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.h
+               COMMAND ${GLIB_MKENUMS} --template 
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/enumtypes-${_output_filename_noext}.h.tmpl" 
"${CMAKE_CURRENT_SOURCE_DIR}/${_enums_header}" >${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.h
+       )
+
+set(SOURCE_TMPL "
+/*** BEGIN file-header ***/
+#include \"${_output_filename_noext}.h\"
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from \"@filename@\" */
+#include \"@filename@\"
+
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type (void)
+{
+       static volatile gsize the_type__volatile = 0;
+
+       if (g_once_init_enter (&the_type__volatile)) {
+               static const G\@Type\@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+                       { \@VALUENAME\@,
+                         \"@VALUENAME@\",
+                         \"@valuenick@\" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+                       { 0, NULL, NULL }
+               };
+               GType the_type = g_\@type\@_register_static (
+                       g_intern_static_string (\"@EnumName@\"),
+                       values);
+               g_once_init_leave (&the_type__volatile, the_type);
+       }
+       return the_type__volatile;
+}
+
+/*** END value-tail ***/")
+
+       file(WRITE 
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/enumtypes-${_output_filename_noext}.c.tmpl" 
"${SOURCE_TMPL}\n")
+
+       add_custom_command(
+               OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.c
+               COMMAND ${GLIB_MKENUMS} --template 
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/enumtypes-${_output_filename_noext}.c.tmpl" 
"${CMAKE_CURRENT_SOURCE_DIR}/${_enums_header}" >${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.c
+       )
+endfunction(glib_mkenums)
+
+find_program(GLIB_GENMARSHAL glib-genmarshal)
+if(NOT GLIB_GENMARSHAL)
+       message(FATAL_ERROR "Cannot find glib-genmarshal, which is required to build ${PROJECT_NAME}")
+endif(NOT GLIB_GENMARSHAL)
+
+function(glib_genmarshal _output_filename_noext _prefix _marshallist_filename)
+       add_custom_command(
+               OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.h
+               COMMAND ${GLIB_GENMARSHAL} --header --prefix=${_prefix} 
"${CMAKE_CURRENT_SOURCE_DIR}/${_marshallist_filename}" 
${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.h.tmp
+               COMMAND ${CMAKE_COMMAND} -E rename 
${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.h.tmp 
${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.h
+               DEPENDS ${_marshallist_filename}
+       )
+
+       add_custom_command(
+               OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.c
+               COMMAND ${CMAKE_COMMAND} -E echo " #include \\\"${_output_filename_noext}.h\\\"" 
${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.c.tmp
+               COMMAND ${GLIB_GENMARSHAL} --body --prefix=${_prefix} 
"${CMAKE_CURRENT_SOURCE_DIR}/${_marshallist_filename}" 
${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.c.tmp
+               COMMAND ${CMAKE_COMMAND} -E rename 
${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.c.tmp 
${CMAKE_CURRENT_BINARY_DIR}/${_output_filename_noext}.c
+               DEPENDS ${_marshallist_filename}
+       )
+endfunction(glib_genmarshal)
+
+find_program(GDBUS_CODEGEN gdbus-codegen)
+if(NOT GDBUS_CODEGEN)
+       message(FATAL_ERROR "Cannot find gdbus-codegen, which is required to build ${PROJECT_NAME}")
+endif(NOT GDBUS_CODEGEN)
+
+function(gdbus_codegen_custom _xml _interface_prefix _c_namespace _files_prefix _list_gens _args)
+       add_custom_command(
+               OUTPUT ${${_list_gens}}
+               COMMAND ${GDBUS_CODEGEN}
+               ARGS --interface-prefix ${_interface_prefix}
+                       --c-namespace ${_c_namespace}
+                       --generate-c-code ${_files_prefix}
+                       --generate-docbook ${_files_prefix}
+                       ${_args}
+                       ${CMAKE_CURRENT_SOURCE_DIR}/${_xml}
+               VERBATIM
+       )
+endfunction(gdbus_codegen_custom)
+
+function(gdbus_codegen _xml _interface_prefix _c_namespace _files_prefix _list_gens)
+       gdbus_codegen_custom(${_xml} ${_interface_prefix} ${_c_namespace} ${_files_prefix} ${_list_gens} "")
+endfunction(gdbus_codegen)
+
+add_printable_option(ENABLE_SCHEMAS_COMPILE "Enable GSettings regeneration of gschemas.compile on install" 
ON)
+
+if(CMAKE_CROSSCOMPILING)
+       find_program(GLIB_COMPILE_SCHEMAS glib-compile-schemas)
+else(CMAKE_CROSSCOMPILING)
+       pkg_check_variable(GLIB_COMPILE_SCHEMAS gio-2.0 glib_compile_schemas)
+endif(CMAKE_CROSSCOMPILING)
+
+if(NOT GLIB_COMPILE_SCHEMAS)
+       message(FATAL_ERROR "Cannot find glib-compile-schemas, which is required to build ${PROJECT_NAME}")
+endif(NOT GLIB_COMPILE_SCHEMAS)
+
+set(GSETTINGS_SCHEMAS_DIR "${SHARE_INSTALL_DIR}/glib-2.0/schemas/")
+
+macro(add_gsettings_schemas _target _schema0)
+       set(_install_code)
+
+       foreach(_schema ${_schema0} ${ARGN})
+               string(REPLACE ".xml" ".valid" _outputfile "${_schema}")
+               get_filename_component(_outputfile "${_outputfile}" NAME)
+
+               get_filename_component(_schema_fullname "${_schema}" DIRECTORY)
+               get_filename_component(_schema_filename "${_schema}" NAME)
+               if(_schema_fullname STREQUAL "")
+                       set(_schema_fullname ${CMAKE_CURRENT_SOURCE_DIR}/${_schema})
+               else(_schema_fullname STREQUAL "")
+                       set(_schema_fullname ${_schema})
+               endif(_schema_fullname STREQUAL "")
+
+               add_custom_command(
+                       OUTPUT ${_outputfile}
+                       COMMAND ${GLIB_COMPILE_SCHEMAS} --strict --dry-run --schema-file=${_schema_fullname}
+                       COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_schema_fullname}" 
"${CMAKE_CURRENT_BINARY_DIR}/${_outputfile}"
+                       DEPENDS ${_schema_fullname}
+                       VERBATIM
+               )
+               add_custom_target(gsettings-schemas-${_schema_filename} ALL DEPENDS ${_outputfile})
+               add_dependencies(${_target} gsettings-schemas-${_schema_filename})
+               if(ENABLE_SCHEMAS_COMPILE)
+                       # this is required to compile gsettings schemas like after 'make install,
+                       # because there is no better way in CMake to run a code/script after
+                       # the whole `make install`
+                       set(_install_code "${_install_code}
+                               COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${_schema_fullname}\" 
\"${GSETTINGS_SCHEMAS_DIR}\""
+                       )
+               endif(ENABLE_SCHEMAS_COMPILE)
+
+               # Do both, to have 'uninstall' working properly
+               install(FILES ${_schema_fullname}
+                       DESTINATION ${GSETTINGS_SCHEMAS_DIR})
+       endforeach(_schema)
+
+       if(_install_code)
+               # Compile gsettings schemas and ensure that all of them are in the place.
+               install(CODE
+                       "execute_process(${_install_code}
+                               COMMAND ${CMAKE_COMMAND} -E chdir . \"${GLIB_COMPILE_SCHEMAS}\" 
\"${GSETTINGS_SCHEMAS_DIR}\"
+                       )")
+       endif(_install_code)
+endmacro(add_gsettings_schemas)
+
+# This is called too early, when the schemas are not installed yet during `make install`
+#
+# compile_gsettings_schemas()
+#    Optionally (based on ENABLE_SCHEMAS_COMPILE) recompiles schemas at the destination folder
+#    after install. It's necessary to call it as the last command in the toplevel CMakeLists.txt,
+#    thus the compile runs when all the schemas are installed.
+#
+if(ENABLE_SCHEMAS_COMPILE)
+       add_custom_command(TARGET uninstall POST_BUILD
+               COMMAND ${CMAKE_COMMAND} -E chdir . "${GLIB_COMPILE_SCHEMAS}" "${GSETTINGS_SCHEMAS_DIR}"
+               COMMENT "Recompile GSettings schemas in '${GSETTINGS_SCHEMAS_DIR}'"
+       )
+endif(ENABLE_SCHEMAS_COMPILE)
+
+find_program(GLIB_COMPILE_RESOURCES glib-compile-resources)
+if(NOT GLIB_COMPILE_RESOURCES)
+       message(FATAL_ERROR "Cannot find glib-compile-resources, which is required to build ${PROJECT_NAME}")
+endif(NOT GLIB_COMPILE_RESOURCES)
+
+macro(glib_compile_resources _sourcedir _outputprefix _cname _inxml)
+       add_custom_command(
+               OUTPUT ${_outputprefix}.h
+               COMMAND ${GLIB_COMPILE_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/${_inxml} 
--target=${_outputprefix}.h --sourcedir=${_sourcedir} --c-name ${_cname} --generate-header
+               DEPENDS ${_inxml} ${ARGN}
+               VERBATIM
+       )
+       add_custom_command(
+               OUTPUT ${_outputprefix}.c
+               COMMAND ${GLIB_COMPILE_RESOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/${_inxml} 
--target=${_outputprefix}.c --sourcedir=${_sourcedir} --c-name ${_cname} --generate-source
+               DEPENDS ${_inxml} ${ARGN}
+               VERBATIM
+       )
+endmacro(glib_compile_resources)
diff --git a/cmake/modules/PkgConfigEx.cmake b/cmake/modules/PkgConfigEx.cmake
new file mode 100644
index 0000000..866fe7c
--- /dev/null
+++ b/cmake/modules/PkgConfigEx.cmake
@@ -0,0 +1,90 @@
+# PkgConfigEx.cmake
+#
+# Extends CMake's PkgConfig module with commands:
+#
+# pkg_check_modules_for_option(_option_name _option_description _prefix _module0)
+#
+#    which calls `pkg_check_modules(_prefix _module0)` and if <_prefix>_FOUND is False,
+#    then prints an error with a hint to disaable the _option_name if needed.
+#
+# pkg_check_exists(_output_name _pkg)
+#
+#    calls pkg-config --exists for _pkg and stores the result to _output_name.
+#
+# pkg_check_at_least_version(_output_name _pkg _version)
+#
+#    calls pkg-config --at-least-version=_version for _pkg and stores the result to _output_name.
+#
+# pkg_check_exact_version(_output_name _pkg _version)
+#
+#    calls pkg-config --exact-version=_version for _pkg and stores the result to _output_name.
+#
+# pkg_check_variable(_output_name _pkg _name)
+#
+#    gets a variable named _name from package _pkg and stores the result into _output_name
+
+find_package(PkgConfig REQUIRED)
+
+macro(pkg_check_modules_for_option _option_name _option_description _prefix _module0)
+       pkg_check_modules(${_prefix} ${_module0} ${ARGN})
+
+       if(NOT ${_prefix}_FOUND)
+               message(FATAL_ERROR "Necessary libraries not found or not enough version. If you want to 
disable ${_option_description}, please use -D${_option_name}=OFF argument to cmake command.")
+       endif(NOT ${_prefix}_FOUND)
+endmacro()
+
+macro(pkg_check_exists _output_name _pkg)
+       execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --exists ${_pkg}
+                       RESULT_VARIABLE ${_output_name})
+
+       # Negate the result, because 0 means 'found'
+       if(${_output_name})
+               set(${_output_name} OFF)
+       else(${_output_name})
+               set(${_output_name} ON)
+       endif(${_output_name})
+endmacro()
+
+macro(pkg_check_at_least_version _output_name _pkg _version)
+       execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --atleast-version=${_version} ${_pkg}
+                       RESULT_VARIABLE ${_output_name})
+
+       # Negate the result, because 0 means 'found'
+       if(${_output_name})
+               set(${_output_name} OFF)
+       else(${_output_name})
+               set(${_output_name} ON)
+       endif(${_output_name})
+endmacro()
+
+macro(pkg_check_exact_version _output_name _pkg _version)
+       execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --exact-version=${_version} ${_pkg}
+                       RESULT_VARIABLE ${_output_name})
+
+       # Negate the result, because 0 means 'found'
+       if(${_output_name})
+               set(${_output_name} OFF)
+       else(${_output_name})
+               set(${_output_name} ON)
+       endif(${_output_name})
+endmacro()
+
+function(pkg_check_variable _output_name _pkg _name)
+    execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_name} ${_pkg}
+                    OUTPUT_VARIABLE _pkg_result
+                    OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+    set("${_output_name}" "${_pkg_result}" CACHE STRING "pkg-config variable ${_name} of ${_pkg}")
+endfunction()
+
+macro(add_pkgconfig_file _input _output)
+       configure_file(
+               ${CMAKE_CURRENT_SOURCE_DIR}/${_input}
+               ${CMAKE_CURRENT_BINARY_DIR}/${_output}
+               @ONLY
+       )
+
+       install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_output}
+               DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
+       )
+endmacro()
diff --git a/cmake/modules/PrintableOptions.cmake b/cmake/modules/PrintableOptions.cmake
new file mode 100644
index 0000000..23ce356
--- /dev/null
+++ b/cmake/modules/PrintableOptions.cmake
@@ -0,0 +1,74 @@
+# PrintableOptions.cmake
+#
+# Provides functions to manage printable otpions,
+# which can be printed at the end of the configuration
+#
+# add_printable_variable_bare(_name)
+#    adds variable named _name to the list of prinable options
+#
+# add_printable_option(_name _description _default_value)
+#    the same as option() commnd, only also notes this option for later printing
+#
+# add_printable_variable(_name _description _default_value)
+#    sets a new cached STRING variable and adds it to the list of printable options
+#
+# add_printable_variable_path(_name _description _default_value)
+#    sets a new cached PATH variable and adds it to the list of printable options
+#
+# print_build_options()
+#    prints all the build options previously added with the above functions
+
+macro(add_printable_variable_bare _name)
+       if(_name STREQUAL "")
+               message(FATAL_ERROR "variable name cannot be empty")
+       endif(_name STREQUAL "")
+       list(APPEND _printable_options ${_name})
+endmacro()
+
+macro(add_printable_option _name _description _default_value)
+       if(_name STREQUAL "")
+               message(FATAL_ERROR "option name cannot be empty")
+       endif(_name STREQUAL "")
+       option(${_name} ${_description} ${_default_value})
+       add_printable_variable_bare(${_name})
+endmacro()
+
+macro(add_printable_variable _name _description _default_value)
+       if(_name STREQUAL "")
+               message(FATAL_ERROR "variable name cannot be empty")
+       endif(_name STREQUAL "")
+       set(${_name} ${_default_value} CACHE STRING ${_description})
+       add_printable_variable_bare(${_name})
+endmacro()
+
+macro(add_printable_variable_path _name _description _default_value)
+       if(_name STREQUAL "")
+               message(FATAL_ERROR "path variable name cannot be empty")
+       endif(_name STREQUAL "")
+       set(${_name} ${_default_value} CACHE PATH ${_description})
+       add_printable_variable_bare(${_name})
+endmacro()
+
+function(print_build_options)
+       message(STATUS "Configure options:")
+
+       set(max_len 0)
+       foreach(opt IN LISTS _printable_options)
+               string(LENGTH "${opt}" len)
+               if(max_len LESS len)
+                       set(max_len ${len})
+               endif(max_len LESS len)
+       endforeach()
+       math(EXPR max_len "${max_len} + 2")
+
+       foreach(opt IN LISTS _printable_options)
+               string(LENGTH "${opt}" len)
+               set(str "   ${opt} ")
+               foreach (IGNORE RANGE ${len} ${max_len})
+                       set(str "${str}.")
+               endforeach ()
+               set(str "${str} ${${opt}}")
+
+               message(STATUS ${str})
+       endforeach()
+endfunction()
diff --git a/cmake/modules/SetupBuildFlags.cmake b/cmake/modules/SetupBuildFlags.cmake
new file mode 100644
index 0000000..a7d2aa4
--- /dev/null
+++ b/cmake/modules/SetupBuildFlags.cmake
@@ -0,0 +1,80 @@
+# SetupBuildFlags.cmake
+#
+# Setups compiler/linker flags, skipping those which are not supported.
+
+include(CheckCCompilerFlag)
+include(CheckCXXCompilerFlag)
+
+macro(setup_build_flags _maintainer_mode)
+       list(APPEND proposed_flags
+               -Werror-implicit-function-declaration
+               -Wformat
+               -Wformat-security
+               -Winit-self
+               -Wmissing-declarations
+               -Wmissing-noreturn
+               -Wpointer-arith
+               -Wredundant-decls
+               -Wundef
+               -Wwrite-strings
+               -no-undefined
+               -fno-strict-aliasing
+       )
+
+       if(_maintainer_mode)
+               list(APPEND proposed_flags
+                       -Wall
+                       -Wextra
+                       -Wdeprecated-declarations
+                       -Wmissing-include-dirs
+               )
+       else(_maintainer_mode)
+               list(APPEND proposed_flags
+                       -Wno-deprecated-declarations
+                       -Wno-missing-include-dir)
+       endif(_maintainer_mode)
+
+       list(APPEND proposed_c_flags
+               ${proposed_flags}
+               -Wdeclaration-after-statement
+               -Wno-missing-field-initializers
+               -Wno-sign-compare
+               -Wno-unused-parameter
+               -Wnested-externs
+       )
+
+       if("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
+               list(APPEND proposed_c_flags
+                       -Wno-parentheses-equality
+                       -Wno-format-nonliteral
+               )
+       endif("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
+
+       list(APPEND proposed_cxx_flags
+               ${proposed_flags}
+               -Wabi
+               -Wnoexcept
+       )
+
+       foreach(flag IN LISTS proposed_c_flags)
+               check_c_compiler_flag(${flag} c_flag_${flag}_supported)
+               if(c_flag_${flag}_supported)
+                       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
+               endif(c_flag_${flag}_supported)
+               unset(c_flag_${flag}_supported)
+       endforeach()
+
+       foreach(flag IN LISTS proposed_cxx_flags)
+               check_cxx_compiler_flag(${flag} cxx_flag_${flag}_supported)
+               if(cxx_flag_${flag}_supported)
+                       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+               endif(cxx_flag_${flag}_supported)
+               unset(cxx_flag_${flag}_supported)
+       endforeach()
+
+       if(("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU"))
+               set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-undefined")
+               set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined")
+               set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
+       endif(("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU"))
+endmacro()
diff --git a/cmake/modules/UninstallTarget.cmake b/cmake/modules/UninstallTarget.cmake
new file mode 100644
index 0000000..7ccfcf3
--- /dev/null
+++ b/cmake/modules/UninstallTarget.cmake
@@ -0,0 +1,13 @@
+# UninstallTarget.cmake
+#
+# Defines a custom target named 'uninstall'
+
+if(NOT TARGET uninstall)
+       configure_file(
+               "${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+               "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
+               IMMEDIATE @ONLY)
+
+       add_custom_target(uninstall
+               COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake)
+endif(NOT TARGET uninstall)
diff --git a/cmake/verify-news-file.sh b/cmake/verify-news-file.sh
new file mode 100755
index 0000000..98d8191
--- /dev/null
+++ b/cmake/verify-news-file.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+# Verifies that the NEWS file's first line contains correct version and date.
+# Requires arguments:
+#   $1 ... the NEWS file name, preferably with full path
+#   $2 ... expected version string, like "1.2.3"
+#
+# The date is expected in a form of YYYY-MM-DD of the current local time.
+# The NEWS line is in form of "PROJECTNAME VERSION DATE".
+#
+# The test can be skipped entirely when SKIP_NEWS_FILE_TEST=1 is set.
+
+FILENAME=$1
+EXPVERSION=$2
+
+if [ ! -f "$FILENAME" ]; then
+       echo "File '$FILENAME' does not exist" 1>&2
+       exit 1
+fi
+
+if [ -z "$EXPVERSION" ]; then
+       echo "Expected version argument not given or empty, use format '1.2.3'" 1>&2
+       exit 1
+fi
+
+NEWSLINE=`head --lines=1 "$FILENAME"`
+EXPDATE=`date +%Y-%m-%d`
+
+NEWSVERSION="${NEWSLINE#* }"
+NEWSDATE="${NEWSVERSION#* }"
+NEWSVERSION="${NEWSVERSION% *}"
+SUCCESS=1
+
+if [ "$NEWSVERSION" != "$EXPVERSION" ]; then
+       echo "Read NEWS version '$NEWSVERSION' doesn't match expected version '$EXPVERSION'" 1>&2
+       SUCCESS=0
+fi
+
+if [ "$NEWSDATE" != "$EXPDATE" ]; then
+       echo "Read NEWS date '$NEWSDATE' doesn't match expected date '$EXPDATE'" 1>&2
+       SUCCESS=0
+fi
+
+if [ "$SUCCESS" != "1" ]; then
+       if [ "$SKIP_NEWS_FILE_TEST" = "1" ]; then
+               echo "" 1>&2
+               echo "****************************************************************" 1>&2
+               echo "*  Failed NEWS file test ignored due to SKIP_NEWS_FILE_TEST=1  *" 1>&2
+               echo "****************************************************************" 1>&2
+               echo "" 1>&2
+               exit 0
+       else
+               echo "(This test can be skipped when SKIP_NEWS_FILE_TEST=1 is set.)" 1>&2
+       fi
+       exit 1
+fi
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..e87bf50
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,22 @@
+/* @PROJECT_NAME@-config.h generated by CMake */
+
+/* Name of the package */
+#define PACKAGE "@PROJECT_NAME@"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "@PROJECT_BUGREPORT@"
+
+/* Version number of the project */
+#define VERSION "@PROJECT_VERSION@"
+
+/* Package name for gettext */
+#define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@"
+
+/* libmapi supports fast-transfer tags from OpenChange 2.1 */
+#cmakedefine HAVE_FAST_TRANSFER_TAGS_2_1 1
+
+/* libmapi defines QueryRows with ForwardRead argument */
+#cmakedefine HAVE_QUERYROWS_FORWARDREAD 1
+
+/* libmapi supports RES_NOT restrictions */
+#cmakedefine HAVE_RES_NOT_SUPPORTED 1
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
new file mode 100644
index 0000000..9e81642
--- /dev/null
+++ b/po/CMakeLists.txt
@@ -0,0 +1 @@
+intltool_setup_po_dir()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..62a560a
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,67 @@
+macro(add_simple_module _name _sourcesvar _depsvar _defsvar _cflagsvar _incdirsvar _ldflagsvar _destination)
+       set(DEPENDENCIES
+               evolution-mapi
+       )
+
+       set(SOURCES
+               ${${_sourcesvar}}
+       )
+
+       add_library(${_name} MODULE
+               ${SOURCES}
+       )
+
+       set_target_properties(${_name} PROPERTIES
+               PREFIX ""
+       )
+
+       add_dependencies(${_name}
+               ${DEPENDENCIES}
+               ${${_depsvar}}
+       )
+
+       target_compile_definitions(${_name} PRIVATE
+               -DG_LOG_DOMAIN=\"${_name}\"
+               -DEXCHANGE_MAPI_LOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
+               ${${_defsvar}}
+       )
+
+       target_compile_options(${_name} PUBLIC
+               ${CAMEL_CFLAGS}
+               ${LIBEBACKEND_CFLAGS}
+               ${LIBEDATASERVER_CFLAGS}
+               ${LIBMAPI_CFLAGS}
+               ${${_cflagsvar}}
+       )
+
+       target_include_directories(${_name} PUBLIC
+               ${CMAKE_BINARY_DIR}
+               ${CMAKE_SOURCE_DIR}
+               ${CAMEL_INCLUDE_DIRS}
+               ${LIBEBACKEND_INCLUDE_DIRS}
+               ${LIBEDATASERVER_INCLUDE_DIRS}
+               ${LIBMAPI_INCLUDE_DIRS}
+               ${${_incdirsvar}}
+       )
+
+       target_link_libraries(${_name}
+               ${DEPENDENCIES}
+               ${${_depsvar}}
+               ${CAMEL_LDFLAGS}
+               ${LIBEBACKEND_LDFLAGS}
+               ${LIBEDATASERVER_LDFLAGS}
+               ${LIBMAPI_LDFLAGS}
+               ${${_ldflagsvar}}
+       )
+
+       install(TARGETS ${_name}
+               DESTINATION ${_destination}
+       )
+endmacro(add_simple_module)
+
+add_subdirectory(addressbook)
+add_subdirectory(calendar)
+add_subdirectory(camel)
+add_subdirectory(collection)
+add_subdirectory(configuration)
+add_subdirectory(libexchangemapi)
diff --git a/src/addressbook/CMakeLists.txt b/src/addressbook/CMakeLists.txt
new file mode 100644
index 0000000..b60c130
--- /dev/null
+++ b/src/addressbook/CMakeLists.txt
@@ -0,0 +1,62 @@
+set(DEPENDENCIES
+       evolution-mapi
+)
+
+set(SOURCES
+       e-book-backend-mapi.c
+       e-book-backend-mapi.h
+       e-book-backend-mapi-contacts.c
+       e-book-backend-mapi-contacts.h
+       e-book-backend-mapi-gal.c
+       e-book-backend-mapi-gal.h
+       e-book-backend-mapi-factory.c
+)
+
+add_library(ebookbackendmapi MODULE
+       ${SOURCES}
+)
+
+add_dependencies(ebookbackendmapi
+       ${DEPENDENCIES}
+)
+
+target_compile_definitions(ebookbackendmapi PRIVATE
+       -DG_LOG_DOMAIN=\"ebookbackendmapi\"
+       -DBACKENDDIR=\"${ebook_backenddir}\"
+       -DEXCHANGE_MAPI_LOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
+)
+
+target_compile_options(ebookbackendmapi PUBLIC
+       ${LIBEBACKEND_CFLAGS}
+       ${LIBEBOOK_CFLAGS}
+       ${LIBEDATABOOK_CFLAGS}
+       ${LIBEDATASERVER_CFLAGS}
+       ${LIBMAPI_CFLAGS}
+)
+
+target_include_directories(ebookbackendmapi PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_BINARY_DIR}/src
+       ${CMAKE_SOURCE_DIR}/src
+       ${CMAKE_CURRENT_BINARY_DIR}
+       ${CMAKE_CURRENT_SOURCE_DIR}
+       ${LIBEBACKEND_INCLUDE_DIRS}
+       ${LIBEBOOK_INCLUDE_DIRS}
+       ${LIBEDATABOOK_INCLUDE_DIRS}
+       ${LIBEDATASERVER_INCLUDE_DIRS}
+       ${LIBMAPI_INCLUDE_DIRS}
+)
+
+target_link_libraries(ebookbackendmapi
+       ${DEPENDENCIES}
+       ${LIBEBACKEND_LDFLAGS}
+       ${LIBEBOOK_LDFLAGS}
+       ${LIBEDATABOOK_LDFLAGS}
+       ${LIBEDATASERVER_LDFLAGS}
+       ${LIBMAPI_LDFLAGS}
+)
+
+install(TARGETS ebookbackendmapi
+       DESTINATION ${ebook_backenddir}
+)
diff --git a/src/addressbook/e-book-backend-mapi-contacts.c b/src/addressbook/e-book-backend-mapi-contacts.c
index d1eda50..b1a07f6 100644
--- a/src/addressbook/e-book-backend-mapi-contacts.c
+++ b/src/addressbook/e-book-backend-mapi-contacts.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/src/addressbook/e-book-backend-mapi-factory.c b/src/addressbook/e-book-backend-mapi-factory.c
index ce03145..c4c664d 100644
--- a/src/addressbook/e-book-backend-mapi-factory.c
+++ b/src/addressbook/e-book-backend-mapi-factory.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 
diff --git a/src/addressbook/e-book-backend-mapi-gal.c b/src/addressbook/e-book-backend-mapi-gal.c
index 26c183b..e189599 100644
--- a/src/addressbook/e-book-backend-mapi-gal.c
+++ b/src/addressbook/e-book-backend-mapi-gal.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <stdlib.h>
 #include <fcntl.h>
diff --git a/src/addressbook/e-book-backend-mapi.c b/src/addressbook/e-book-backend-mapi.c
index f5f3cc6..355bae8 100644
--- a/src/addressbook/e-book-backend-mapi.c
+++ b/src/addressbook/e-book-backend-mapi.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <stdlib.h>
 #include <string.h>
diff --git a/src/calendar/CMakeLists.txt b/src/calendar/CMakeLists.txt
new file mode 100644
index 0000000..5a0f8fd
--- /dev/null
+++ b/src/calendar/CMakeLists.txt
@@ -0,0 +1,56 @@
+set(DEPENDENCIES
+       evolution-mapi
+)
+
+set(SOURCES
+       e-cal-backend-mapi-factory.c
+       e-cal-backend-mapi.c
+       e-cal-backend-mapi.h
+)
+
+add_library(ecalbackendmapi MODULE
+       ${SOURCES}
+)
+
+add_dependencies(ecalbackendmapi
+       ${DEPENDENCIES}
+)
+
+target_compile_definitions(ecalbackendmapi PRIVATE
+       -DG_LOG_DOMAIN=\"ecalbackendmapi\"
+       -DEXCHANGE_MAPI_LOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
+)
+
+target_compile_options(ecalbackendmapi PUBLIC
+       ${CAMEL_CFLAGS}
+       ${LIBEBACKEND_CFLAGS}
+       ${LIBECAL_CFLAGS}
+       ${LIBEDATACAL_CFLAGS}
+       ${LIBMAPI_CFLAGS}
+)
+
+target_include_directories(ecalbackendmapi PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_BINARY_DIR}/src
+       ${CMAKE_SOURCE_DIR}/src
+       ${CMAKE_CURRENT_BINARY_DIR}
+       ${CAMEL_INCLUDE_DIRS}
+       ${LIBEBACKEND_INCLUDE_DIRS}
+       ${LIBECAL_INCLUDE_DIRS}
+       ${LIBEDATACAL_INCLUDE_DIRS}
+       ${LIBMAPI_INCLUDE_DIRS}
+)
+
+target_link_libraries(ecalbackendmapi
+       ${DEPENDENCIES}
+       ${CAMEL_LDFLAGS}
+       ${LIBEBACKEND_LDFLAGS}
+       ${LIBECAL_LDFLAGS}
+       ${LIBEDATACAL_LDFLAGS}
+       ${LIBMAPI_LDFLAGS}
+)
+
+install(TARGETS ecalbackendmapi
+       DESTINATION ${ecal_backenddir}
+)
diff --git a/src/calendar/e-cal-backend-mapi-factory.c b/src/calendar/e-cal-backend-mapi-factory.c
index 1f13d34..20f676a 100644
--- a/src/calendar/e-cal-backend-mapi-factory.c
+++ b/src/calendar/e-cal-backend-mapi-factory.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index 7fce4fd..9e34118 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 #include <gio/gio.h>
diff --git a/src/camel/CMakeLists.txt b/src/camel/CMakeLists.txt
new file mode 100644
index 0000000..5604dc9
--- /dev/null
+++ b/src/camel/CMakeLists.txt
@@ -0,0 +1,130 @@
+install(FILES libcamelmapi.urls
+       DESTINATION ${camel_providerdir}
+)
+
+# *************************************************
+# Installed private library which can be linked to
+# *************************************************
+
+set(DEPENDENCIES
+       evolution-mapi
+)
+
+set(SOURCES
+       camel-mapi-folder.c
+       camel-mapi-folder.h
+       camel-mapi-folder-summary.c
+       camel-mapi-folder-summary.h
+       camel-mapi-sasl-krb.c
+       camel-mapi-sasl-krb.h
+        camel-mapi-store.c
+        camel-mapi-store.h
+       camel-mapi-store-summary.c
+       camel-mapi-store-summary.h
+       camel-mapi-transport.c
+       camel-mapi-transport.h
+)
+
+add_library(camelmapi-priv SHARED
+       ${SOURCES}
+)
+
+add_dependencies(camelmapi-priv
+       ${DEPENDENCIES}
+)
+
+target_compile_definitions(camelmapi-priv PRIVATE
+       -DG_LOG_DOMAIN=\"camel-mapi-provider\"
+       -DEXCHANGE_MAPI_LOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
+)
+
+target_compile_options(camelmapi-priv PUBLIC
+       ${CAMEL_CFLAGS}
+       ${EVOLUTION_MAIL_CFLAGS}
+       ${LIBEDATASERVER_CFLAGS}
+       ${LIBECAL_CFLAGS}
+       ${LIBMAPI_CFLAGS}
+)
+
+target_include_directories(camelmapi-priv PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_BINARY_DIR}/src
+       ${CMAKE_SOURCE_DIR}/src
+       ${CMAKE_CURRENT_BINARY_DIR}
+       ${CAMEL_INCLUDE_DIRS}
+       ${EVOLUTION_MAIL_INCLUDE_DIRS}
+       ${LIBEDATASERVER_INCLUDE_DIRS}
+       ${LIBECAL_INCLUDE_DIRS}
+       ${LIBMAPI_INCLUDE_DIRS}
+)
+
+target_link_libraries(camelmapi-priv
+       ${DEPENDENCIES}
+       ${CAMEL_LDFLAGS}
+       ${EVOLUTION_MAIL_LDFLAGS}
+       ${LIBEDATASERVER_LDFLAGS}
+       ${LIBECAL_LDFLAGS}
+       ${LIBMAPI_LDFLAGS}
+)
+
+install(TARGETS camelmapi-priv
+       DESTINATION ${privsolibdir}
+)
+
+# *************************************************
+# Provider module
+# *************************************************
+
+set(DEPENDENCIES
+       camelmapi-priv
+       evolution-mapi
+)
+
+set(SOURCES
+       camel-mapi-provider.c
+)
+
+add_library(camelmapi MODULE
+       ${SOURCES}
+)
+
+add_dependencies(camelmapi
+       ${DEPENDENCIES}
+)
+
+target_compile_definitions(camelmapi PRIVATE
+       -DG_LOG_DOMAIN=\"camel-mapi-provider\"
+       -DEXCHANGE_MAPI_LOCALEDIR=\"${LOCALE_INSTALL_DIR}\"
+)
+
+target_compile_options(camelmapi PUBLIC
+       ${CAMEL_CFLAGS}
+       ${LIBEDATASERVER_CFLAGS}
+       ${LIBECAL_CFLAGS}
+       ${LIBMAPI_CFLAGS}
+)
+
+target_include_directories(camelmapi PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_BINARY_DIR}/src
+       ${CMAKE_SOURCE_DIR}/src
+       ${CMAKE_CURRENT_BINARY_DIR}
+       ${CAMEL_INCLUDE_DIRS}
+       ${LIBEDATASERVER_INCLUDE_DIRS}
+       ${LIBECAL_INCLUDE_DIRS}
+       ${LIBMAPI_INCLUDE_DIRS}
+)
+
+target_link_libraries(camelmapi
+       ${DEPENDENCIES}
+       ${CAMEL_LDFLAGS}
+       ${LIBEDATASERVER_LDFLAGS}
+       ${LIBECAL_LDFLAGS}
+       ${LIBMAPI_LDFLAGS}
+)
+
+install(TARGETS camelmapi
+       DESTINATION ${camel_providerdir}
+)
diff --git a/src/camel/camel-mapi-folder-summary.c b/src/camel/camel-mapi-folder-summary.c
index 9023a72..922ca0b 100644
--- a/src/camel/camel-mapi-folder-summary.c
+++ b/src/camel/camel-mapi-folder-summary.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <errno.h>
 #include <stdlib.h>
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index e03efd0..cc726b3 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <string.h>
 #include <time.h>
diff --git a/src/camel/camel-mapi-provider.c b/src/camel/camel-mapi-provider.c
index 84b2737..ca752aa 100644
--- a/src/camel/camel-mapi-provider.c
+++ b/src/camel/camel-mapi-provider.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <sys/types.h>
 #include <string.h>
diff --git a/src/camel/camel-mapi-sasl-krb.c b/src/camel/camel-mapi-sasl-krb.c
index 3f744a3..7fda05b 100644
--- a/src/camel/camel-mapi-sasl-krb.c
+++ b/src/camel/camel-mapi-sasl-krb.c
@@ -14,9 +14,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <string.h>
 
diff --git a/src/camel/camel-mapi-store-summary.c b/src/camel/camel-mapi-store-summary.c
index 07da88c..cef8fb0 100644
--- a/src/camel/camel-mapi-store-summary.c
+++ b/src/camel/camel-mapi-store-summary.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <ctype.h>
 #include <errno.h>
diff --git a/src/camel/camel-mapi-store.c b/src/camel/camel-mapi-store.c
index 69f992d..336ab5f 100644
--- a/src/camel/camel-mapi-store.c
+++ b/src/camel/camel-mapi-store.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <stdint.h>
 #include <stdbool.h>
diff --git a/src/camel/camel-mapi-transport.c b/src/camel/camel-mapi-transport.c
index 6865186..78d9a9a 100644
--- a/src/camel/camel-mapi-transport.c
+++ b/src/camel/camel-mapi-transport.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <string.h>
 
diff --git a/src/collection/CMakeLists.txt b/src/collection/CMakeLists.txt
new file mode 100644
index 0000000..99b0d3d
--- /dev/null
+++ b/src/collection/CMakeLists.txt
@@ -0,0 +1,22 @@
+set(extra_deps)
+set(sources
+       module-mapi-backend.c
+       e-mapi-backend.c
+       e-mapi-backend.h
+       e-mapi-backend-factory.c
+       e-mapi-backend-factory.h
+)
+set(extra_defines)
+set(extra_cflags)
+set(extra_incdirs)
+set(extra_ldflags)
+
+add_simple_module(module-mapi-backend
+       sources
+       extra_deps
+       extra_defines
+       extra_cflags
+       extra_incdirs
+       extra_ldflags
+       "${eds_moduledir}"
+)
diff --git a/src/collection/e-mapi-backend.c b/src/collection/e-mapi-backend.c
index 1769556..fdf8a30 100644
--- a/src/collection/e-mapi-backend.c
+++ b/src/collection/e-mapi-backend.c
@@ -16,9 +16,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 
diff --git a/src/collection/module-mapi-backend.c b/src/collection/module-mapi-backend.c
index 0d27ae5..40fa78f 100644
--- a/src/collection/module-mapi-backend.c
+++ b/src/collection/module-mapi-backend.c
@@ -16,9 +16,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 
diff --git a/src/configuration/CMakeLists.txt b/src/configuration/CMakeLists.txt
new file mode 100644
index 0000000..72e6044
--- /dev/null
+++ b/src/configuration/CMakeLists.txt
@@ -0,0 +1,57 @@
+set(extra_deps
+       camelmapi-priv
+)
+set(sources
+       module-mapi-configuration.c
+       e-book-config-mapi.c
+       e-book-config-mapi.h
+       e-book-config-mapigal.c
+       e-book-config-mapigal.h
+       e-cal-config-mapi.c
+       e-cal-config-mapi.h
+       e-mail-config-mapi-backend.c
+       e-mail-config-mapi-backend.h
+       e-mail-config-mapi-page.c
+       e-mail-config-mapi-page.h
+       e-mail-config-mapi-extension.c
+       e-mail-config-mapi-extension.h
+       e-mapi-config-ui-extension.c
+       e-mapi-config-ui-extension.h
+       e-mapi-config-utils.c
+       e-mapi-config-utils.h
+       e-mapi-edit-folder-permissions.c
+       e-mapi-edit-folder-permissions.h
+       e-mapi-search-gal-user.c
+       e-mapi-search-gal-user.h
+       e-mapi-subscribe-foreign-folder.c
+       e-mapi-subscribe-foreign-folder.h
+)
+set(extra_defines)
+set(extra_cflags
+       ${EVOLUTION_MAIL_CFLAGS}
+       ${EVOLUTION_SHELL_CFLAGS}
+       ${LIBECAL_CFLAGS}
+       ${LIBEBOOK_CFLAGS}
+)
+set(extra_incdirs
+       ${EVOLUTION_MAIL_INCLUDE_DIRS}
+       ${EVOLUTION_SHELL_INCLUDE_DIRS}
+       ${LIBECAL_INCLUDE_DIRS}
+       ${LIBEBOOK_INCLUDE_DIRS}
+)
+set(extra_ldflags
+       ${EVOLUTION_MAIL_LDFLAGS}
+       ${EVOLUTION_SHELL_LDFLAGS}
+       ${LIBECAL_LDFLAGS}
+       ${LIBEBOOK_LDFLAGS}
+)
+
+add_simple_module(module-mapi-configuration
+       sources
+       extra_deps
+       extra_defines
+       extra_cflags
+       extra_incdirs
+       extra_ldflags
+       "${evo_moduledir}"
+)
diff --git a/src/configuration/e-book-config-mapi.c b/src/configuration/e-book-config-mapi.c
index 13effc3..aebdc03 100644
--- a/src/configuration/e-book-config-mapi.c
+++ b/src/configuration/e-book-config-mapi.c
@@ -16,9 +16,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include "e-book-config-mapi.h"
 #include "e-mapi-config-utils.h"
diff --git a/src/configuration/e-book-config-mapigal.c b/src/configuration/e-book-config-mapigal.c
index 518317a..6841842 100644
--- a/src/configuration/e-book-config-mapigal.c
+++ b/src/configuration/e-book-config-mapigal.c
@@ -16,9 +16,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 
diff --git a/src/configuration/e-cal-config-mapi.c b/src/configuration/e-cal-config-mapi.c
index fbb0ae5..f0ffede 100644
--- a/src/configuration/e-cal-config-mapi.c
+++ b/src/configuration/e-cal-config-mapi.c
@@ -16,9 +16,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include "e-cal-config-mapi.h"
 #include "e-mapi-config-utils.h"
diff --git a/src/configuration/e-mail-config-mapi-backend.c b/src/configuration/e-mail-config-mapi-backend.c
index 8c346da..37dbbaa 100644
--- a/src/configuration/e-mail-config-mapi-backend.c
+++ b/src/configuration/e-mail-config-mapi-backend.c
@@ -16,9 +16,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 
diff --git a/src/configuration/e-mail-config-mapi-extension.c 
b/src/configuration/e-mail-config-mapi-extension.c
index 186d685..df094a3 100644
--- a/src/configuration/e-mail-config-mapi-extension.c
+++ b/src/configuration/e-mail-config-mapi-extension.c
@@ -16,9 +16,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <mail/e-mail-config-notebook.h>
 
diff --git a/src/configuration/e-mail-config-mapi-page.c b/src/configuration/e-mail-config-mapi-page.c
index 806d803..b82f3f9 100644
--- a/src/configuration/e-mail-config-mapi-page.c
+++ b/src/configuration/e-mail-config-mapi-page.c
@@ -16,9 +16,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <gtk/gtk.h>
 #include <glib/gi18n-lib.h>
diff --git a/src/configuration/e-mapi-config-ui-extension.c b/src/configuration/e-mapi-config-ui-extension.c
index cdaf2ac..9d834cc 100644
--- a/src/configuration/e-mapi-config-ui-extension.c
+++ b/src/configuration/e-mapi-config-ui-extension.c
@@ -16,9 +16,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
diff --git a/src/configuration/e-mapi-config-utils.c b/src/configuration/e-mapi-config-utils.c
index ea2c384..387f390 100644
--- a/src/configuration/e-mapi-config-utils.c
+++ b/src/configuration/e-mapi-config-utils.c
@@ -16,9 +16,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <string.h>
 #include <unistd.h>
diff --git a/src/configuration/e-mapi-edit-folder-permissions.c 
b/src/configuration/e-mapi-edit-folder-permissions.c
index 35ade8a..33e6941 100644
--- a/src/configuration/e-mapi-edit-folder-permissions.c
+++ b/src/configuration/e-mapi-edit-folder-permissions.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
diff --git a/src/configuration/e-mapi-search-gal-user.c b/src/configuration/e-mapi-search-gal-user.c
index 1512d2a..12a4a1b 100644
--- a/src/configuration/e-mapi-search-gal-user.c
+++ b/src/configuration/e-mapi-search-gal-user.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
diff --git a/src/configuration/e-mapi-subscribe-foreign-folder.c 
b/src/configuration/e-mapi-subscribe-foreign-folder.c
index ac3c5f5..08047a0 100644
--- a/src/configuration/e-mapi-subscribe-foreign-folder.c
+++ b/src/configuration/e-mapi-subscribe-foreign-folder.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 #include <gtk/gtk.h>
diff --git a/src/configuration/module-mapi-configuration.c b/src/configuration/module-mapi-configuration.c
index 211b317..20136e4 100644
--- a/src/configuration/module-mapi-configuration.c
+++ b/src/configuration/module-mapi-configuration.c
@@ -16,9 +16,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 
diff --git a/src/libexchangemapi/CMakeLists.txt b/src/libexchangemapi/CMakeLists.txt
new file mode 100644
index 0000000..d214c43
--- /dev/null
+++ b/src/libexchangemapi/CMakeLists.txt
@@ -0,0 +1,81 @@
+install(FILES  tz-mapi-to-ical
+               tz-ical-to-mapi
+       DESTINATION ${mapidatadir}
+)
+
+set(SOURCES
+       camel-mapi-settings.c
+       camel-mapi-settings.h
+       e-mapi-fast-transfer.h
+       e-mapi-fast-transfer.c
+       e-mapi-defs.h
+       e-mapi-folder.c
+       e-mapi-folder.h
+       e-mapi-connection.c
+       e-mapi-connection.h
+       e-mapi-debug.c
+       e-mapi-debug.h
+       e-mapi-utils.c
+       e-mapi-utils.h
+       e-mapi-book-utils.c
+       e-mapi-book-utils.h
+       e-mapi-cal-utils.c
+       e-mapi-cal-utils.h
+       e-mapi-cal-tz-utils.c
+       e-mapi-cal-tz-utils.h
+       e-mapi-cal-recur-utils.c
+       e-mapi-cal-recur-utils.h
+       e-mapi-mail-utils.c
+       e-mapi-mail-utils.h
+       e-mapi-operation-queue.c
+       e-mapi-operation-queue.h
+       e-source-mapi-folder.c
+       e-source-mapi-folder.h
+)
+
+add_library(evolution-mapi SHARED
+       ${SOURCES}
+)
+
+target_compile_definitions(evolution-mapi PRIVATE
+       -DG_LOG_DOMAIN=\"evolution-mapi\"
+       -DMAPI_DATADIR=\"${mapidatadir}\"
+       -DLIBMAPI_LDIF_DIR=\"${libmapi_ldif_dir}\"
+)
+
+target_compile_options(evolution-mapi PUBLIC
+       ${CAMEL_CFLAGS}
+       ${EVOLUTION_DATA_SERVER_CFLAGS}
+       ${LIBEBOOK_CFLAGS}
+       ${LIBECAL_CFLAGS}
+       ${LIBEDATASERVER_CFLAGS}
+       ${LIBMAPI_CFLAGS}
+)
+
+target_include_directories(evolution-mapi PUBLIC
+       ${CMAKE_BINARY_DIR}
+       ${CMAKE_SOURCE_DIR}
+       ${CMAKE_BINARY_DIR}/src
+       ${CMAKE_SOURCE_DIR}/src
+       ${CMAKE_CURRENT_BINARY_DIR}
+       ${CMAKE_CURRENT_SOURCE_DIR}
+       ${CAMEL_INCLUDE_DIRS}
+       ${EVOLUTION_DATA_SERVER_INCLUDE_DIRS}
+       ${LIBEBOOK_INCLUDE_DIRS}
+       ${LIBECAL_INCLUDE_DIRS}
+       ${LIBEDATASERVER_INCLUDE_DIRS}
+       ${LIBMAPI_INCLUDE_DIRS}
+)
+
+target_link_libraries(evolution-mapi
+       ${CAMEL_LDFLAGS}
+       ${EVOLUTION_DATA_SERVER_LDFLAGS}
+       ${LIBEBOOK_LDFLAGS}
+       ${LIBECAL_LDFLAGS}
+       ${LIBEDATASERVER_LDFLAGS}
+       ${LIBMAPI_LDFLAGS}
+)
+
+install(TARGETS evolution-mapi
+       DESTINATION ${privsolibdir}
+)
diff --git a/src/libexchangemapi/e-mapi-book-utils.c b/src/libexchangemapi/e-mapi-book-utils.c
index a15e5ce..9f0283c 100644
--- a/src/libexchangemapi/e-mapi-book-utils.c
+++ b/src/libexchangemapi/e-mapi-book-utils.c
@@ -18,9 +18,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <libedataserver/libedataserver.h>
 
diff --git a/src/libexchangemapi/e-mapi-cal-recur-utils.c b/src/libexchangemapi/e-mapi-cal-recur-utils.c
index 797dc02..3274a30 100644
--- a/src/libexchangemapi/e-mapi-cal-recur-utils.c
+++ b/src/libexchangemapi/e-mapi-cal-recur-utils.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <libecal/libecal.h>
 
diff --git a/src/libexchangemapi/e-mapi-cal-tz-utils.c b/src/libexchangemapi/e-mapi-cal-tz-utils.c
index b68f675..72abe0c 100644
--- a/src/libexchangemapi/e-mapi-cal-tz-utils.c
+++ b/src/libexchangemapi/e-mapi-cal-tz-utils.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include "e-mapi-cal-tz-utils.h"
 
diff --git a/src/libexchangemapi/e-mapi-cal-utils.c b/src/libexchangemapi/e-mapi-cal-utils.c
index b41bf92..2b1bb53 100644
--- a/src/libexchangemapi/e-mapi-cal-utils.c
+++ b/src/libexchangemapi/e-mapi-cal-utils.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
diff --git a/src/libexchangemapi/e-mapi-connection.c b/src/libexchangemapi/e-mapi-connection.c
index 29e5723..2ba0d08 100644
--- a/src/libexchangemapi/e-mapi-connection.c
+++ b/src/libexchangemapi/e-mapi-connection.c
@@ -22,9 +22,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 #include <camel/camel.h>
diff --git a/src/libexchangemapi/e-mapi-fast-transfer.c b/src/libexchangemapi/e-mapi-fast-transfer.c
index 05fb207..9a6cbfb 100644
--- a/src/libexchangemapi/e-mapi-fast-transfer.c
+++ b/src/libexchangemapi/e-mapi-fast-transfer.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include "e-mapi-connection.h"
 #include "e-mapi-debug.h"
diff --git a/src/libexchangemapi/e-mapi-folder.c b/src/libexchangemapi/e-mapi-folder.c
index a1cdb13..1c19181 100644
--- a/src/libexchangemapi/e-mapi-folder.c
+++ b/src/libexchangemapi/e-mapi-folder.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib/gi18n-lib.h>
 
diff --git a/src/libexchangemapi/e-mapi-mail-utils.c b/src/libexchangemapi/e-mapi-mail-utils.c
index 835c687..7f5d5ad 100644
--- a/src/libexchangemapi/e-mapi-mail-utils.c
+++ b/src/libexchangemapi/e-mapi-mail-utils.c
@@ -17,9 +17,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <camel/camel.h>
 #include <libecal/libecal.h>
diff --git a/src/libexchangemapi/e-mapi-mail-utils.h b/src/libexchangemapi/e-mapi-mail-utils.h
index 1cf2357..b4dccba 100644
--- a/src/libexchangemapi/e-mapi-mail-utils.h
+++ b/src/libexchangemapi/e-mapi-mail-utils.h
@@ -20,9 +20,7 @@
 #ifndef E_MAPI_MAIL_UTILS_H
 #define E_MAPI_MAIL_UTILS_H 
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib.h>
 #include <gio/gio.h>
diff --git a/src/libexchangemapi/e-mapi-operation-queue.c b/src/libexchangemapi/e-mapi-operation-queue.c
index 86b504d..95dec04 100644
--- a/src/libexchangemapi/e-mapi-operation-queue.c
+++ b/src/libexchangemapi/e-mapi-operation-queue.c
@@ -18,9 +18,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <stdio.h>
 #include "e-mapi-operation-queue.h"
diff --git a/src/libexchangemapi/e-mapi-utils.c b/src/libexchangemapi/e-mapi-utils.c
index b88052f..092cf79 100644
--- a/src/libexchangemapi/e-mapi-utils.c
+++ b/src/libexchangemapi/e-mapi-utils.c
@@ -21,9 +21,7 @@
  *
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "evolution-mapi-config.h"
 
 #include <glib.h>
 #include <gio/gio.h>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]