[evolution-data-server/wip/cmake] Merge changes from the evolution



commit 099094509a714d3d2a2665b6742ee498714642bf
Author: Milan Crha <mcrha redhat com>
Date:   Tue Oct 4 19:19:28 2016 +0200

    Merge changes from the evolution

 cmake/modules/FindLDAP.cmake       |    8 +++---
 cmake/modules/GLibTools.cmake      |   26 +++++++++++++++++++++
 cmake/modules/InstalledTests.cmake |   43 ++++++++++++++++++++++++++++++++++++
 3 files changed, 73 insertions(+), 4 deletions(-)
---
diff --git a/cmake/modules/FindLDAP.cmake b/cmake/modules/FindLDAP.cmake
index 73c0d31..bc3bf86 100644
--- a/cmake/modules/FindLDAP.cmake
+++ b/cmake/modules/FindLDAP.cmake
@@ -13,8 +13,8 @@
 #    HAVE_LDAP - set to ON, if LDAP support is enabled and libraries found
 #    SUNLDAP - set to ON, when using SunLDAP implementation
 #    LDAP_CFLAGS - CFLAGS to use with target_compile_options() and similar commands
-#    LDAP_INCLDUE_DIRS - include directories to use with target_include_directories() and similar commands
-#    LDAP_LDFLAGS - LDFLAGS to use with target_link_libraries() and similar commands
+#    LDAP_INCLUDE_DIRS - include directories to use with target_include_directories() and similar commands
+#    LDAP_LIBS - libraries to use with target_link_libraries() and similar commands
 
 include(CheckCSourceCompiles)
 include(CheckLibraryExists)
@@ -66,10 +66,10 @@ else(WITH_OPENLDAP)
 endif(WITH_OPENLDAP)
 
 set(LDAP_CFLAGS "")
-set(LDAP_INCLUDE_DIRECTORIES "${LDAP_PREFIX}/include")
+set(LDAP_INCLUDE_DIRS "${LDAP_PREFIX}/include")
 set(LDAP_LIBS "-L${LDAP_PREFIX}/lib${LIB_SUFFIX}")
 
-set(CMAKE_REQUIRED_INCLUDES "${LDAP_INCLUDE_DIRECTORIES}")
+set(CMAKE_REQUIRED_INCLUDES "${LDAP_INCLUDE_DIRS}")
 set(CMAKE_REQUIRED_LIBRARIES "${LDAP_LIBS}")
 
 if(WITH_OPENLDAP)
diff --git a/cmake/modules/GLibTools.cmake b/cmake/modules/GLibTools.cmake
index b247238..ba05824 100644
--- a/cmake/modules/GLibTools.cmake
+++ b/cmake/modules/GLibTools.cmake
@@ -15,6 +15,11 @@
 #        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.
@@ -131,6 +136,27 @@ GType
        )
 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)
diff --git a/cmake/modules/InstalledTests.cmake b/cmake/modules/InstalledTests.cmake
index ed1faa8..ec44553 100644
--- a/cmake/modules/InstalledTests.cmake
+++ b/cmake/modules/InstalledTests.cmake
@@ -10,6 +10,10 @@
 #    used for add_executable()), while the target name should match
 #    the executable name. The _type and _environ are used for populating
 #    the .test meta file.
+#
+# install_behave_tests_if_enabled(_testsvar _type _environ)
+#    Adds rules to install the 'behave' tests as stored in _testsvar
+#    in the current source directory.
 
 include(PrintableOptions)
 
@@ -43,3 +47,42 @@ Exec=${TEST_ENVIRONMENT}${INSTALLED_TESTS_EXEC_DIR}/${_test_target}
                )
        endif(ENABLE_INSTALLED_TESTS)
 endmacro(install_test_if_enabled)
+
+macro(install_behave_tests_if_enabled _testsvar _type _environ)
+       if(ENABLE_INSTALLED_TESTS)
+               set(TEST_TYPE ${_type})
+               set(TEST_ENVIRONMENT)
+               if(NOT ${_environ} STREQUAL "")
+                       set(TEST_ENVIRONMENT "env ${_environ} ")
+               endif(NOT ${_environ} STREQUAL "")
+
+               file(GLOB BEHAVE_FEATURES ${CMAKE_CURRENT_SOURCE_DIR}/*.feature)
+               file(GLOB BEHAVE_STEP_DEFINITIONS ${CMAKE_CURRENT_SOURCE_DIR}/steps/*.py)
+               set(BEHAVE_COMMON_FILES
+                       ${CMAKE_CURRENT_SOURCE_DIR}/environment.py
+                       ${CMAKE_CURRENT_SOURCE_DIR}/common_steps.py
+               )
+
+               install(FILES ${BEHAVE_FEATURES} ${BEHAVE_COMMON_FILES}
+                       DESTINATION ${INSTALLED_TESTS_EXEC_DIR}
+               )
+
+               install(FILES ${BEHAVE_STEP_DEFINITIONS}
+                       DESTINATION ${INSTALLED_TESTS_EXEC_DIR}/steps/
+               )
+
+               foreach(_test ${${_testsvar}})
+                       set(teststring "[Test]
+Type=${TEST_TYPE}
+Exec=${TEST_ENVIRONMENT}behave ${INSTALLED_TESTS_EXEC_DIR} -t ${_test} -k -f html -o ${_test}.html -f plain
+"
+)
+
+                       file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_test}.test "${teststring}")
+
+                       install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_test}.test
+                               DESTINATION ${INSTALLED_TESTS_META_DIR}
+                       )
+               endforeach(_test)
+       endif(ENABLE_INSTALLED_TESTS)
+endmacro(install_behave_tests_if_enabled)


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