Commit 6bcf7e2d authored by Milan Crha's avatar Milan Crha

Convert from autotools to CMake

parent a41cfe62
build
_build
.build
# Evolution-EWS build script
cmake_minimum_required(VERSION 3.0)
cmake_policy(VERSION 3.0)
project(evolution-ews
VERSION 3.23.1
LANGUAGES C CXX)
set(PROJECT_BUGREPORT "http://bugzilla.gnome.org/enter_bug.cgi?product=evolution-ews")
# 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
-DENABLE_TESTS=ON
)
# 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)
# Keep these two definitions in agreement.
set(soup_minimum_version 2.42)
set(soup_encoded_version SOUP_VERSION_2_42)
# 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})
add_definitions(-DSOUP_VERSION_MAX_ALLOWED=${soup_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})
add_definitions(-DSOUP_VERSION_MIN_REQUIRED=${soup_encoded_version})
set(eds_minimum_version ${PROJECT_VERSION})
set(evo_minimum_version ${PROJECT_VERSION})
set(mspack_minimum_version 0.4)
# 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})
set(MATH_LDFLAGS -lm)
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(EVOLUTION_CALENDAR evolution-calendar-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(SOUP libsoup-2.4>=${soup_minimum_version})
# ******************************
# libmspack with OAB support
# ******************************
add_printable_option(WITH_MSPACK "Use libmspack for OAB decompress" ON)
if(WITH_MSPACK)
pkg_check_modules_for_option(WITH_MSPACK "libmspack for OAB decompress" MSPACK libmspack>=${mspack_minimum_version})
endif(WITH_MSPACK)
# ******************************
# SOUP_MESSAGE_IDEMPOTENT flag
# ******************************
set(CMAKE_REQUIRED_INCLUDES ${SOUP_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${SOUP_LDFLAGS})
CHECK_C_SOURCE_COMPILES("#include <libsoup/soup.h>
int main(void) { SoupMessageFlags flag; flag = SOUP_MESSAGE_IDEMPOTENT; return 0; }" HAVE_SOUP_MESSAGE_IDEMPOTENT_FLAG)
unset(CMAKE_REQUIRED_INCLUDES)
unset(CMAKE_REQUIRED_LIBRARIES)
# ******************************
# uhttpmock for tests
# ******************************
add_printable_option(ENABLE_TESTS "Enable low level tests for EwsConnection" OFF)
if(ENABLE_TESTS)
pkg_check_modules_for_option(ENABLE_TESTS "low level tests" UHTTPMOCK libuhttpmock-0.0)
endif(ENABLE_TESTS)
# ******************************
# 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(ewsdatadir evolution-data-server-1.2 privdatadir)
set(ewsdatadir "${ewsdatadir}/ews")
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-ews.metainfo.xml.in evolution-ews.metainfo.xml)
add_subdirectory(po)
add_subdirectory(src)
if(ENABLE_TESTS)
add_subdirectory(tests)
endif(ENABLE_TESTS)
if ENABLE_TESTS
TESTS_DIR = tests
endif
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
@GNOME_CODE_COVERAGE_RULES@
NULL =
SUBDIRS = src po $(TESTS_DIR)
changelogs = \
ChangeLog \
$(NULL)
@INTLTOOL_XML_RULE@
metainfodir = $(datadir)/appdata
metainfo_in_files = evolution-ews.metainfo.xml.in
metainfo_files = $(metainfo_in_files:.xml.in=.xml)
dist_metainfo_DATA = $(metainfo_files)
EXTRA_DIST = \
$(changelog) \
$(metainfo_in_files) \
enumtypes.c.template \
enumtypes.h.template \
intltool-merge.in \
intltool-update.in \
intltool-extract.in \
$(NULL)
CLEANFILES = \
intltool-merge \
intltool-update \
intltool-extract \
$(NULL)
DISTCLEANFILES = $(metainfo_files)
MAINTAINERCLEANFILES = \
$(srcdir)/INSTALL \
$(srcdir)/aclocal.m4 \
$(srcdir)/autoscan.log \
$(srcdir)/compile \
$(srcdir)/config.guess \
$(srcdir)/config.h.in \
$(srcdir)/config.sub \
$(srcdir)/configure.scan \
$(srcdir)/depcomp \
$(srcdir)/gtk-doc.make \
$(srcdir)/install-sh \
$(srcdir)/ltmain.sh \
$(srcdir)/missing \
$(srcdir)/mkinstalldirs \
$(srcdir)/m4/gtk-doc.m4 \
$(srcdir)/m4/intltool.m4 \
$(srcdir)/m4/libtool.m4 \
$(srcdir)/m4/ltoptions.m4 \
$(srcdir)/m4/ltsugar.m4 \
$(srcdir)/m4/ltversion.m4 \
$(srcdir)/m4/lt~obsolete.m4 \
$(NULL)
# XXX with-internal-lzx is temporary. Remove this
# once libmspack >= 0.4 becomes more widespread.
DISTCHECK_CONFIGURE_FLAGS = \
--with-internal-lzx \
--enable-tests \
$(NULL)
-include $(top_srcdir)/git.mk
......@@ -2,9 +2,18 @@
1. BUILD
$ ./autogen.sh
$ make
$ make install
$ cd .../sources/evolution-ews
$ mkdir build
$ cd build
$ cmake -G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX=/opt/evolution \
-DCMAKE_BUILD_TYPE=Release \
..
$ make -j
$ make -j install
Run `cmake --help` to get list of available generators (the -G argument)
on your platform.
========================
......
dnl as-compiler-flag.m4 0.1.0
dnl autostars m4 macro for detection of compiler flags
dnl David Schleef <ds@schleef.org>
dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $
dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
dnl Tries to compile with the given CFLAGS.
dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
dnl and ACTION-IF-NOT-ACCEPTED otherwise.
AC_DEFUN([AS_COMPILER_FLAG],
[
AC_MSG_CHECKING([to see if compiler understands $1])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
CFLAGS="$save_CFLAGS"
if test "X$flag_ok" = Xyes ; then
m4_ifvaln([$2],[$2])
true
else
m4_ifvaln([$3],[$3])
true
fi
AC_MSG_RESULT([$flag_ok])
])
dnl AS_COMPILER_FLAGS(VAR, FLAGS)
dnl Tries to compile with the given CFLAGS.
AC_DEFUN([AS_COMPILER_FLAGS],
[
list=$2
flags_supported=""
flags_unsupported=""
AC_MSG_CHECKING([for supported compiler flags])
for each in $list
do
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $each"
AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
CFLAGS="$save_CFLAGS"
if test "X$flag_ok" = Xyes ; then
flags_supported="$flags_supported $each"
else
flags_unsupported="$flags_unsupported $each"
fi
done
AC_MSG_RESULT([$flags_supported])
if test "X$flags_unsupported" != X ; then
AC_MSG_WARN([unsupported compiler flags: $flags_unsupported])
fi
$1="$$1 $flags_supported"
])
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
(test -f $srcdir/configure.ac \
&& test -f $srcdir/ChangeLog \
&& test -d $srcdir/src/camel) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" >&2
echo " top-level evolution-ews directory" >&2
exit 1
}
olddir=`pwd`
cd $srcdir
check_exists() {
variable=`which $1`
if test -z $variable; then
echo "*** No $1 found, please intall it ***" >&2
exit 1
fi
}
check_exists aclocal
check_exists autoreconf
check_exists gtkdocize
check_exists intltoolize
m4dir=`autoconf --trace 'AC_CONFIG_MACRO_DIR:$1'`
if [ -n "$m4dir" ]; then
mkdir -p $m4dir
fi
aclocal -I m4 || exit $?
gtkdocize --copy || exit $?
intltoolize --force --copy --automake || exit $?
autoreconf --verbose --force --install -Wno-portability || exit $?
cd $olddir
test -n "$NOCONFIGURE" || "$srcdir/configure" --enable-maintainer-mode "$@"
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)
# 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)
# 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)
# 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
)
# 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)
# 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)