Page MenuHomePhorge

CMakeLists.txt
No OneTemporary

Authored By
Unknown
Size
5 KB
Referenced Files
None
Subscribers
None

CMakeLists.txt

project(libkolabxml NONE)
cmake_minimum_required(VERSION 2.6)
# only available from cmake-2.8.0
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 7)
cmake_policy(SET CMP0012 NEW)
endif()
# only available from cmake-2.8.4
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 7 AND
${CMAKE_PATCH_VERSION} GREATER 3)
cmake_policy(SET CMP0017 NEW)
endif()
set (KOLABXML_VERSION_MAJOR 0)
set (KOLABXML_VERSION_MINOR 2)
set (KOLABXML_VERSION_RELEASE 0)
set (KOLABXML_VERSION "${KOLABXML_VERSION_MAJOR}.${KOLABXML_VERSION_MINOR}.${KOLABXML_VERSION_RELEASE}" )
set (KOLABXML_VERSION_STRING ${CMAKE_PROJECT_NAME}-${KOLABXML_VERSION})
set (KOLAB_FORMAT_VERSION "3.0dev1")
#It's possible to make dist targets only using:
#cmake -DDIST_ONLY=TRUE ..
if (DIST_ONLY)
message("Building DIST targets only (make dist, make snapshot)")
#make dist requires a tag with ${ARCHIVE_NAME} (e.g. libkolabxml-0.2.0)
set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${KOLABXML_VERSION})
add_custom_target(dist
COMMAND git archive --prefix=${ARCHIVE_NAME}/ ${ARCHIVE_NAME}
| bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
#snapshot of current development version
set(SNAPSHOTARCHIVE_NAME "${CMAKE_PROJECT_NAME}-${KOLABXML_VERSION}-HEAD")
add_custom_target(snapshot
COMMAND git archive --prefix=${SNAPSHOTARCHIVE_NAME}/ HEAD
| bzip2 > ${CMAKE_BINARY_DIR}/${SNAPSHOTARCHIVE_NAME}.tar.bz2
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
return()
endif()
#C++ is required from here on
enable_language(CXX)
configure_file(libkolabxml-version.h.cmake "${CMAKE_BINARY_DIR}/libkolabxml-version.h" @ONLY)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
include( cmake/modules/FindKolabInternal.cmake )
add_subdirectory(cmake/modules)
set(Boost_USE_MULTITHREADED ON)
find_package(Boost REQUIRED COMPONENTS thread)
if (Boost_FOUND)
message("Found boost in ${Boost_INCLUDE_DIRS}")
include_directories(${Boost_INCLUDE_DIRS})
endif (Boost_FOUND)
if (${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.42)
find_library(UUID NAMES ossp-uuid)
if(UUID)
message("uuid found")
else (UUID)
message(FATAL_ERROR "uuid NOT found!")
endif(UUID)
endif()
find_package(Qt4)
find_program( XSDCXX xsdcxx /usr/bin/)
if(XSDCXX)
message("xsd code generator found")
else (XSDCXX)
message(FATAL_ERROR
"xsd code generator NOT found!")
endif(XSDCXX)
find_library(XERCES_C NAMES xerces-c xerces-c_2)
if(XERCES_C)
message("xerces found")
else (XERCES_C)
message(FATAL_ERROR
"xerces NOT found!")
endif(XERCES_C)
find_program(SWIG swig /usr/bin/)
if(SWIG)
set(SWIG_FOUND ON)
message("SWIG found")
endif(SWIG)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
# set( CMAKE_VERBOSE_MAKEFILE on )
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
file(MAKE_DIRECTORY ${CMAKE_BUILD_DIR}/bindings)
set( SCHEMA_DIR ${CMAKE_SOURCE_DIR}/schemas )
# Generate bindings
set( SCHEMAS
${SCHEMA_DIR}/ical/kolabformat-xcal.xsd
${SCHEMA_DIR}/ical/iCalendar-params.xsd
${SCHEMA_DIR}/ical/iCalendar-props.xsd
${SCHEMA_DIR}/ical/iCalendar-valtypes.xsd
${SCHEMA_DIR}/xCard.xsd
${SCHEMA_DIR}/kolabformat-xcard.xsd
${SCHEMA_DIR}/kolabformat.xsd
)
set( SCHEMA_SOURCEFILES
${CMAKE_BUILD_DIR}/bindings/kolabformat.cxx
${CMAKE_BUILD_DIR}/bindings/xCard.cxx
${CMAKE_BUILD_DIR}/bindings/kolabformat-xcal.cxx
${CMAKE_BUILD_DIR}/bindings/kolabformat-xcard.cxx
${CMAKE_BUILD_DIR}/bindings/iCalendar-params.cxx
${CMAKE_BUILD_DIR}/bindings/iCalendar-props.cxx
${CMAKE_BUILD_DIR}/bindings/iCalendar-valtypes.cxx
# bindings/iCalendar-link-extension.cxx
# bindings/iCalendar-bw-extensions.cxx
# bindings/iCalendar-ms-extensions.cxx
)
#xsdcxx cxx-tree --generate-xml-schema --generate-serialization --custom-type date_time --hxx-epilogue '#include "bindings/customtypes/xml-schema-custom.hxx"' xml-schema.xsd
# --generate-inline --extern-xml-schema xml-schema.xsd
# --cxx-suffix .cpp --hxx-suffix .h
add_custom_command(OUTPUT ${SCHEMA_SOURCEFILES}
COMMAND ${XSDCXX} cxx-tree --generate-polymorphic --generate-serialization --namespace-map http://kolab.org=KolabXSD --root-element icalendar --root-element vcards --root-element note --output-dir ${CMAKE_BUILD_DIR}/bindings ${SCHEMAS}
COMMENT "Generating XSD bindings"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS ${SCHEMAS}
VERBATIM
)
# Compile Schemas
find_program(XSDBIN_FOUND xsdbin)
if (XSDBIN_FOUND)
add_custom_command(OUTPUT kolabformat-xcal-schema.cxx
COMMAND ${XSDBIN_FOUND} --verbose --array-name iCalendar_schema --output-dir ${CMAKE_BUILD_DIR} ${SCHEMAS}
COMMENT "Compiling Kolab XSD schema"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS ${SCHEMAS}
VERBATIM
)
else (XSDBIN_FOUND)
add_executable(xsdbin compiled/xsdbin.cxx)
target_link_libraries(xsdbin ${XERCES_C})
add_custom_command(OUTPUT kolabformat-xcal-schema.cxx
COMMAND ${CMAKE_BUILD_DIR}/xsdbin --verbose --array-name iCalendar_schema --output-dir ${CMAKE_BUILD_DIR} ${SCHEMAS}
COMMENT "Compiling Kolab XSD schema"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS ${SCHEMAS} xsdbin
VERBATIM
)
endif (XSDBIN_FOUND)
set( SCHEMA_SOURCEFILES ${SCHEMA_SOURCEFILES} ${CMAKE_BUILD_DIR}/kolabformat-xcal-schema.cxx)
# ---------
SET_SOURCE_FILES_PROPERTIES(${SCHEMA_SOURCEFILES} PROPERTIES GENERATED 1)
ADD_CUSTOM_TARGET(generate_bindings ALL DEPENDS ${SCHEMA_SOURCEFILES})
include_directories( ./ )
include_directories( compiled )
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
add_subdirectory(src)
if (QT4_FOUND)
add_subdirectory(tests)
else()
message("Qt libraries have not been found, not building tests")
endif()

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 5, 10:18 PM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18826672
Default Alt Text
CMakeLists.txt (5 KB)

Event Timeline