summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
blob: a203450fbef2f0f184397f5ee823d93b2915884a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

#This property is not available anymore here, although present in the parent file.
SET_SOURCE_FILES_PROPERTIES(${SCHEMA_SOURCEFILES} PROPERTIES GENERATED 1)

set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wp,-D_FORTIFY_SOURCE=2 -O2" ) #always generate shared libraries with -fPIC, -D_FORTIFY_SOURCE=2 enables some extra checking

# Library with serialization/deserialization code and kolab-containers
add_library(kolabxml SHARED
    kolabformat.cpp
    containers/kolabcontainers.cpp
    containers/kolabnote.cpp
    containers/kolabevent.cpp
    containers/kolabtodo.cpp
    containers/kolabjournal.cpp
    containers/kolabcontact.cpp
    containers/kolabconfiguration.cpp
    utils.cpp base64.cpp
    ../compiled/XMLParserWrapper.cpp
    ../compiled/grammar-input-stream.cxx
    ${SCHEMA_SOURCEFILES}
)
add_dependencies(kolabxml generate_bindings)
target_link_libraries(kolabxml ${XERCES_C} ${Boost_LIBRARIES} ${UUID})

# For the core library we can be stricter when compiling. This doesn't work with the auto generated code though.
if (${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.42)
    # We can't be as strict on with older versions of boost it seems (not sure if this is the exact version number where it breaks)
    # Since this is only for el5 compatibility we relax the rules (resulting in a couple of warning but a working build)
    #for development add here -Werror -Wfatal-errors (but don't for releases)
    set_target_properties(kolabxml PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Wconversion")
else() #then normal case
    #for development add here -Werror -Wfatal-errors (but don't for releases)
    set_target_properties(kolabxml PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Wconversion -Wl,--no-undefined")
endif()

set_target_properties(kolabxml PROPERTIES VERSION ${Libkolabxml_VERSION} SOVERSION ${Libkolabxml_VERSION_MAJOR})

install(TARGETS kolabxml EXPORT LibkolabxmlExport 
    RUNTIME DESTINATION ${BIN_INSTALL_DIR}
    LIBRARY DESTINATION ${LIB_INSTALL_DIR}
    ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)

install( FILES
    kolabformat.h
    containers/kolabevent.h
    containers/kolabevent_p.h
    containers/incidence_p.h
    containers/kolabtodo.h
    containers/kolabjournal.h
    containers/kolabcontact.h
    containers/kolabnote.h
    containers/kolabcontainers.h
    containers/kolabconfiguration.h
    global_definitions.h
    DESTINATION ${INCLUDE_INSTALL_DIR})

#-----------------------SWIG--------------------
# Building of the bindings can be controlled using the switches along the lines of: cmake -DPHP_BINDINGS=TRUE -DCSHARP_BINDINGS=FALSE ..
if (SWIG_FOUND)
    if(CSHARP_BINDINGS)
        message("building csharp bindings")
        add_subdirectory(csharp)
    endif(CSHARP_BINDINGS)
    if(JAVA_BINDINGS)
        message("building java bindings")
        add_subdirectory(java)
    endif(JAVA_BINDINGS)
    if(PYTHON_BINDINGS)
        message("building python bindings")
        add_subdirectory(python)
    endif(PYTHON_BINDINGS)
    if(PHP_BINDINGS)
        message("building php bindings")
        add_subdirectory(php)
    endif(PHP_BINDINGS)
else()
    message(WARNING "Could not build SWIG bindings, because SWIG is missing.")
endif()