Branch 'dev/libkolab' - 5 commits - c++/CMakeLists.txt c++/compiled c++/lib cmake/modules c++/tests .gitignore libkolab/akonadi-version.h.cmake libkolab/CMakeLists.txt libkolab/kolabformat upgradetool/CMakeLists.txt upgradetool/upgradetooltests.cpp upgradetool/upgradeutilities.cpp

Christian Mollekopf mollekopf at kolabsys.com
Fri Mar 23 12:57:48 CET 2012


 .gitignore                            |    1 
 c++/CMakeLists.txt                    |   11 +++++
 c++/compiled/XMLParserWrapper.cpp     |    6 +-
 c++/lib/CMakeLists.txt                |   13 +++---
 c++/lib/kolabconversions.h            |    4 -
 c++/lib/utils.cpp                     |   16 +++++++
 c++/lib/xcalconversions.h             |    4 -
 c++/lib/xcardconversions.h            |    4 -
 c++/tests/conversiontest.cpp          |    7 +++
 c++/tests/conversiontest.h            |    2 
 cmake/modules/FindKDELibraries.cmake  |   18 ++++++++
 cmake/modules/FindKolabInternal.cmake |   51 ++++++++++++++++++++++++
 libkolab/CMakeLists.txt               |   14 +++---
 libkolab/akonadi-version.h.cmake      |   25 +++++++++++
 libkolab/kolabformat/kolabobject.cpp  |   71 ++++++++++++++++++++++------------
 libkolab/kolabformat/kolabobject.h    |   21 ++++------
 upgradetool/CMakeLists.txt            |   40 ++++---------------
 upgradetool/upgradetooltests.cpp      |    2 
 upgradetool/upgradeutilities.cpp      |    4 -
 19 files changed, 221 insertions(+), 93 deletions(-)

New commits:
commit a5fbc9c6820d0fc6625cbf44896b50d34732793a
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Fri Mar 23 12:57:17 2012 +0100

    Fix includes and library finding.

diff --git a/cmake/modules/FindKDELibraries.cmake b/cmake/modules/FindKDELibraries.cmake
new file mode 100644
index 0000000..45e6c57
--- /dev/null
+++ b/cmake/modules/FindKDELibraries.cmake
@@ -0,0 +1,18 @@
+#Find some libraries
+find_library(KCALCORE_LIBRARY NAMES kcalcore)
+if(KCALCORE_LIBRARY)
+    set(KCALCORE_LIBRARY_FOUND ON)
+    message("KCalCore found")
+endif(KCALCORE_LIBRARY)
+
+find_library(KMIME_LIBRARY NAMES kmime)
+if(KMIME_LIBRARY)
+    set(KMIME_LIBRARY_FOUND ON)
+    message("KMime found")
+endif(KMIME_LIBRARY)
+
+find_library(KABC_LIBRARY NAMES kabc)
+if(KABC_LIBRARY)
+    set(KABC_LIBRARY_FOUND ON)
+    message("KABC found")
+endif(KABC_LIBRARY)
\ No newline at end of file
diff --git a/libkolab/CMakeLists.txt b/libkolab/CMakeLists.txt
index 71d9e47..c00fdc7 100644
--- a/libkolab/CMakeLists.txt
+++ b/libkolab/CMakeLists.txt
@@ -3,12 +3,12 @@ project(libkolab)
 cmake_minimum_required(VERSION 2.6)
 
 include( ../cmake/modules/FindKolabInternal.cmake )
+include (../cmake/modules/FindKDELibraries.cmake)
 
 find_package(Qt4 REQUIRED)
 find_package(KDE4 REQUIRED)
 
 find_library(KOLABXML NAMES kolabxml)
-# find_library(KOLABKCAL NAMES kolabkcal)
 
 set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS} -fPIC" )
 
@@ -30,7 +30,7 @@ set(LIBRARY_TYPE STATIC)
 add_subdirectory(kolabformatV2)
 
 add_library(kolab SHARED kolabformat/kolabobject.cpp mime/mimeutils.cpp conversion/kcalconversion.cpp)
-target_link_libraries(kolab kolabformatV2  ${KOLABXML} kcalcore kmime ${QT_QTCORE_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBRARY} kabc akonadi-kde ${KDE4_KIO_LIBRARY})
+target_link_libraries(kolab kolabformatV2  ${KOLABXML} ${KCALCORE_LIBRARY} ${KMIME_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBRARY} ${KABC_LIBRARY} akonadi-kde ${KDE4_KIO_LIBRARY})
 set_target_properties(kolab PROPERTIES VERSION 0.1 SOVERSION 0)
 
 install(TARGETS kolab EXPORT libkolabLibraryTargets ${KOLAB_INSTALL_DIRECTORIES})
diff --git a/libkolab/kolabformat/kolabobject.cpp b/libkolab/kolabformat/kolabobject.cpp
index 0a0cbc2..c3603a5 100644
--- a/libkolab/kolabformat/kolabobject.cpp
+++ b/libkolab/kolabformat/kolabobject.cpp
@@ -26,9 +26,7 @@
 #include <mime/mimeutils.h>
 #include <conversion/kcalconversion.h>
 #include <qdom.h>
-#include <kcalcore/journal.h>
 #include <kdebug.h>
-#include <kabc/addressee.h>
 #include <qbuffer.h>
 #include <kolab/kolabformat.h>
 
@@ -196,20 +194,43 @@ KCalCore::Event::Ptr readV2EventXML(const QByteArray& xmlData, QStringList& atta
 }
 
 
+//@cond PRIVATE
+class KolabObjectReader::Private
+{
+public:
+    Private()
+    : mObjectType( InvalidObject ),
+    mVersion( KolabV3 )
+    {}
+    
+    KCalCore::Incidence::Ptr mIncidence;
+    KABC::Addressee mAddressee;
+    KABC::ContactGroup mContactGroup;
+    ObjectType mObjectType;
+    Version mVersion;
+};
+//@endcond
+
 KolabObjectReader::KolabObjectReader()
+: d( new KolabObjectReader::Private )
 {
     
 }
 
 KolabObjectReader::KolabObjectReader(const KMime::Message::Ptr& msg)
+: d( new KolabObjectReader::Private )
 {
     parseMimeMessage(msg);
 }
 
+KolabObjectReader::~KolabObjectReader()
+{
+    delete d;
+}
 
 ObjectType KolabObjectReader::parseMimeMessage(const KMime::Message::Ptr &msg)
 {
-    mObjectType = InvalidObject;
+    d->mObjectType = InvalidObject;
     KMime::Headers::Base *xKolabHeader = msg->getHeaderByType("X-Kolab-Type");
     if (!xKolabHeader) {
         kWarning() << "could not find xKolabHeader";
@@ -226,74 +247,74 @@ ObjectType KolabObjectReader::parseMimeMessage(const KMime::Message::Ptr &msg)
     QStringList attachments;
     KCalCore::Incidence::Ptr i;
     kDebug() << kolabType;
-    mVersion = KolabV2;
+    d->mVersion = KolabV2;
     if (kolabType == eventKolabType()) { //Event
         kDebug() << "event";
-        mIncidence = fromXML<KCalCore::Event::Ptr, KolabV2::Event>(xmlData, attachments);
-        mObjectType = EventObject;
+        d->mIncidence = fromXML<KCalCore::Event::Ptr, KolabV2::Event>(xmlData, attachments);
+        d->mObjectType = EventObject;
     } else if (kolabType == todoKolabType()) { //Todo 
         kDebug() << "todo";
-        mIncidence = fromXML<KCalCore::Todo::Ptr, KolabV2::Task>(xmlData, attachments);
-        mObjectType = TodoObject;
+        d->mIncidence = fromXML<KCalCore::Todo::Ptr, KolabV2::Task>(xmlData, attachments);
+        d->mObjectType = TodoObject;
     } else if (kolabType == journalKolabType()) { //Journal
         kDebug() << "journal";
-        mIncidence = fromXML<KCalCore::Journal::Ptr, KolabV2::Journal>(xmlData, attachments);
-        mObjectType = JournalObject;
+        d->mIncidence = fromXML<KCalCore::Journal::Ptr, KolabV2::Journal>(xmlData, attachments);
+        d->mObjectType = JournalObject;
     } else if (kolabType == contactKolabType()) { //Contact
         kDebug() << "contact";
-        mAddressee = addresseFromKolab(xmlData, msg);
-        mObjectType = ContactObject;
+        d->mAddressee = addresseFromKolab(xmlData, msg);
+        d->mObjectType = ContactObject;
     }  else if (kolabType == distlistKolabType()) { //Distlist
         kDebug() << "distlist";
-        mContactGroup = contactGroupFromKolab(xmlData);
-        mObjectType = DistlistObject;
+        d->mContactGroup = contactGroupFromKolab(xmlData);
+        d->mObjectType = DistlistObject;
     } else {
         kWarning() << "no kolab object found " << kolabType;
     }
-    if (mIncidence) {
-        Mime::getAttachments(mIncidence, attachments, msg);
+    if (d->mIncidence) {
+        Mime::getAttachments(d->mIncidence, attachments, msg);
     }
-    return mObjectType;
+    return d->mObjectType;
 }
 
 Version KolabObjectReader::getVersion() const
 {
-    return mVersion;
+    return d->mVersion;
 }
 
 ObjectType KolabObjectReader::getType() const
 {
-    return mObjectType;
+    return d->mObjectType;
 }
 
 KCalCore::Event::Ptr KolabObjectReader::getEvent() const
 {
-    return mIncidence.dynamicCast<KCalCore::Event>();
+    return d->mIncidence.dynamicCast<KCalCore::Event>();
 }
 
 KCalCore::Todo::Ptr KolabObjectReader::getTodo() const
 {
-    return mIncidence.dynamicCast<KCalCore::Todo>();
+    return d->mIncidence.dynamicCast<KCalCore::Todo>();
 }
 
 KCalCore::Journal::Ptr KolabObjectReader::getJournal() const
 {
-    return mIncidence.dynamicCast<KCalCore::Journal>();
+    return d->mIncidence.dynamicCast<KCalCore::Journal>();
 }
 
 KCalCore::Incidence::Ptr KolabObjectReader::getIncidence() const
 {
-    return mIncidence;
+    return d->mIncidence;
 }
 
 KABC::Addressee KolabObjectReader::getContact() const
 {
-    return mAddressee;
+    return d->mAddressee;
 }
 
 KABC::ContactGroup KolabObjectReader::getDistlist() const
 {
-    return mContactGroup;
+    return d->mContactGroup;
 }
 
 
diff --git a/libkolab/kolabformat/kolabobject.h b/libkolab/kolabformat/kolabobject.h
index 672c72c..a20ce99 100644
--- a/libkolab/kolabformat/kolabobject.h
+++ b/libkolab/kolabformat/kolabobject.h
@@ -20,17 +20,13 @@
 
 #include "kolab_export.h"
 
+#include <kabc/addressee.h>
+#include <kabc/contactgroup.h>
 #include <kcalcore/incidence.h>
 #include <kcalcore/event.h>
 #include <kcalcore/journal.h>
 #include <kcalcore/todo.h>
 #include <kmime/kmime_message.h>
-#include <kabc/addressee.h>
-#include <kabc/contactgroup.h>
-
-namespace KABC {
-class Addressee;
-}
 
 namespace Kolab {
 
@@ -60,7 +56,9 @@ KOLAB_EXPORT KCalCore::Event::Ptr readV2EventXML(const QByteArray &xmlData, QStr
 class KOLAB_EXPORT KolabObjectReader {
 public:
     KolabObjectReader();
-    KolabObjectReader(const KMime::Message::Ptr &msg);
+    explicit KolabObjectReader(const KMime::Message::Ptr &msg);
+    ~KolabObjectReader();
+    
     ObjectType parseMimeMessage(const KMime::Message::Ptr &msg);
     
     ObjectType getType() const;
@@ -73,11 +71,10 @@ public:
     KABC::Addressee getContact() const;
     KABC::ContactGroup getDistlist() const;
 private:
-    KCalCore::Incidence::Ptr mIncidence;
-    KABC::Addressee mAddressee;
-    KABC::ContactGroup mContactGroup;
-    ObjectType mObjectType;
-    Version mVersion;
+    //@cond PRIVATE
+    class Private;
+    Private *const d;
+    //@endcond
 };
 
 class KOLAB_EXPORT KolabObjectWriter {
diff --git a/upgradetool/CMakeLists.txt b/upgradetool/CMakeLists.txt
index b0ab376..3ba6cb0 100644
--- a/upgradetool/CMakeLists.txt
+++ b/upgradetool/CMakeLists.txt
@@ -5,37 +5,15 @@ cmake_minimum_required(VERSION 2.6)
 find_package(Qt4 REQUIRED)
 find_package(KDE4 REQUIRED)
 
-find_library(KOLABXML NAMES kolabxml)
-# find_library(KOLABFORMATV2 NAMES kolabformatV2)
-# find_library(KOLABKCAL NAMES kolabkcal)
-find_library(KOLAB NAMES kolab)
-
-find_library(KCALCORE NAMES kcalcore)
-if(KCALCORE)
-    set(KCALCORE_FOUND ON)
-    message("KCalCore found")
-endif(KCALCORE)
-
-include_directories(/opt/devel/global/include ${QT_INCLUDES} /usr/local/include/kolab .)
-link_directories(/opt/devel/global/lib)
-
-find_library(KMIME_LIBS NAMES kmime)
-if(KMIME_LIBS)
-    set(KMIME_LIBS_FOUND ON)
-    message("KMime found")
-endif(KMIME_LIBS)
-
-# find_library(KOLABFORMATV2 NAMES kolabformat_v2 PATHS /opt/devel/global/lib)
-# if(KOLABFORMATV2)
-#     set(KOLABFORMATV2_FOUND ON)
-#     message("KOLABFORMATV2 found")
-# endif(KOLABFORMATV2)
-# set(KOLABFORMATV2 /opt/devel/global/lib/libkolabformat_v2.so)
-
-message(${KOLAB})
-
-set(COMMON_DEPENDENCIES  ${KOLAB} ${KOLABXML} ${KCALCORE} ${KDE4_KDECORE_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTXML_LIBRARY} ${KMIME_LIBS} ${QT_GUI_LIBRARY})
-message(${COMMON_DEPENDENCIES})
+find_library(KOLABXML_LIBRARY NAMES kolabxml)
+find_library(KOLAB_LIBRARY NAMES kolab)
+
+include (../cmake/modules/FindKolabInternal.cmake)
+include (../cmake/modules/FindKDELibraries.cmake)
+
+include_directories(${QT_INCLUDES} ./)
+
+set(COMMON_DEPENDENCIES  ${KOLAB_LIBRARY} ${KOLABXML_LIBRARY} ${KCALCORE_LIBRARY} ${KDE4_KDECORE_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTXML_LIBRARY} ${KMIME_LIBRARY} ${QT_GUI_LIBRARY} ${KABC_LIBRARY})
 add_executable(upgradetool upgradetool.cpp upgradeutilities.cpp)
 target_link_libraries(upgradetool ${COMMON_DEPENDENCIES})
 
diff --git a/upgradetool/upgradetooltests.cpp b/upgradetool/upgradetooltests.cpp
index 4782795..e1cba10 100644
--- a/upgradetool/upgradetooltests.cpp
+++ b/upgradetool/upgradetooltests.cpp
@@ -1,6 +1,6 @@
 #include "upgradetooltests.h"
 #include "upgradeutilities.h"
-#include <kolabformat.h>
+#include <kolab/kolabformat.h>
 #include <kdebug.h>
 
 void UpgradeToolTests::testConvertEvent()
diff --git a/upgradetool/upgradeutilities.cpp b/upgradetool/upgradeutilities.cpp
index e6e2ec3..8a22676 100644
--- a/upgradetool/upgradeutilities.cpp
+++ b/upgradetool/upgradeutilities.cpp
@@ -21,8 +21,8 @@
 #include <kolab/kcalconversion.h>
 #include <kdebug.h>
 
-#include <kolabevent.h>
-#include <kolabformat.h>
+#include <kolab/kolabevent.h>
+#include <kolab/kolabformat.h>
 
 namespace Kolab {
     namespace Upgrade {


commit f81bec24cf872f2435af79b83570367f2ade41c7
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Fri Mar 23 12:41:26 2012 +0100

    Fix the header install directory

diff --git a/cmake/modules/FindKolabInternal.cmake b/cmake/modules/FindKolabInternal.cmake
index 1ccf0d5..9e817eb 100644
--- a/cmake/modules/FindKolabInternal.cmake
+++ b/cmake/modules/FindKolabInternal.cmake
@@ -6,6 +6,7 @@
 # The Result of this can be overridden by setting KOLAB_LIB_INSTALL_DIR "cmake -DKOLAB_LIB_INSTALL_DIR=/usr/lib64/ ."
 #
 # The runtime install is controlled by KOLAB_BIN_INSTALL_DIR
+# The header install is controlled by KOLAB_HEADER_INSTALL_DIR
 #
 # KOLAB_INSTALL_DIRECTORIES contains the determined install directories and should be used with install commands
 
@@ -41,4 +42,10 @@ set(KOLAB_INSTALL_DIRECTORIES  RUNTIME DESTINATION "${KOLAB_BIN_INSTALL_DIR}"
                                   LIBRARY DESTINATION "${KOLAB_LIB_INSTALL_DIR}"
                                   ARCHIVE DESTINATION "${KOLAB_LIB_INSTALL_DIR}" COMPONENT Devel )
 
-set(KOLAB_HEADER_INSTALL_DIR  "${INCLUDE_INSTALL_DIR}/kolab")
+
+if(KOLAB_HEADER_INSTALL_DIR)
+    message("KOLAB_HEADER_INSTALL_DIR specified manually")
+else()
+    set(KOLAB_HEADER_INSTALL_DIR  "${CMAKE_INSTALL_PREFIX}/include")
+endif()
+message("KOLAB_HEADER_INSTALL_DIR: ${KOLAB_HEADER_INSTALL_DIR}")


commit 6972232592b43631fa0c76d78dc5ac5af3641184
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Fri Mar 23 12:15:05 2012 +0100

    Install libraries to the correct (64bit) directory. Make it possible to override the determined path.

diff --git a/.gitignore b/.gitignore
index 99bb8e6..2325ff8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,6 @@ CMakeFiles
 CMakeCache.txt
 moc_*
 *.moc
-*.cmake
 *.pyc
 .*.swp
 configure
diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt
index 0fb586e..c76f992 100644
--- a/c++/CMakeLists.txt
+++ b/c++/CMakeLists.txt
@@ -13,6 +13,8 @@ if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 7 AND
     cmake_policy(SET CMP0017 NEW)
 endif()
 
+include( ../cmake/modules/FindKolabInternal.cmake )
+
 find_package(Boost COMPONENTS thread REQUIRED)
 
 if (${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.42)
diff --git a/c++/lib/CMakeLists.txt b/c++/lib/CMakeLists.txt
index 7b7e163..90f31f0 100644
--- a/c++/lib/CMakeLists.txt
+++ b/c++/lib/CMakeLists.txt
@@ -11,7 +11,8 @@ 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.
 set_target_properties(kolabxml PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wl,--no-undefined")
 set_target_properties(kolabxml PROPERTIES VERSION 3.0.0 SOVERSION 0)
-install(TARGETS kolabxml LIBRARY DESTINATION lib)
+
+install(TARGETS kolabxml ${KOLAB_INSTALL_DIRECTORIES})
 
 install( FILES
     kolabformat.h
@@ -22,7 +23,7 @@ install( FILES
     kolabnote.h
     kolabcontainers.h
     global_definitions.h
-    DESTINATION include/kolab COMPONENT Devel)
+    DESTINATION ${KOLAB_HEADER_INSTALL_DIR} COMPONENT Devel)
 
 #----- The following makes sure libkolabxml is found in the install directory for installed files and not in the build directory (for libraries which link to libkolabxml)
 
@@ -30,14 +31,14 @@ install( FILES
 SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
 # when building, don't use the install RPATH already(but later on when installing)
 SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 
-SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+SET(CMAKE_INSTALL_RPATH "${KOLAB_LIB_INSTALL_DIR}")
 # add the automatically determined parts of the RPATH
 # which point to directories outside the build tree to the install RPATH
 SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
 # the RPATH to be used when installing, but only if it's not a system directory
-LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${KOLAB_LIB_INSTALL_DIR}" isSystemDir)
 IF("${isSystemDir}" STREQUAL "-1")
-   SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+   SET(CMAKE_INSTALL_RPATH "${KOLAB_LIB_INSTALL_DIR}")
 ENDIF("${isSystemDir}" STREQUAL "-1")
 
 #-----------------------SWIG--------------------
diff --git a/cmake/modules/FindKolabInternal.cmake b/cmake/modules/FindKolabInternal.cmake
new file mode 100644
index 0000000..1ccf0d5
--- /dev/null
+++ b/cmake/modules/FindKolabInternal.cmake
@@ -0,0 +1,44 @@
+
+# The install directory is defined by the CMAKE_INSTALL_PREFIX which defaults to /usr/local if not specified.
+# To install i.e. to /usr use "cmake -DCMAKE_INSTALL_PREFIX=/usr ."
+#
+# The library directory suffix (64/32) is detected automatically based on the available directories in CMAKE_INSTALL_PREFIX
+# The Result of this can be overridden by setting KOLAB_LIB_INSTALL_DIR "cmake -DKOLAB_LIB_INSTALL_DIR=/usr/lib64/ ."
+#
+# The runtime install is controlled by KOLAB_BIN_INSTALL_DIR
+#
+# KOLAB_INSTALL_DIRECTORIES contains the determined install directories and should be used with install commands
+
+get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+
+if (${LIB64} STREQUAL "TRUE")
+    find_path(LIB32FOUND "${CMAKE_INSTALL_PREFIX}/lib32")
+    find_path(LIB64FOUND "${CMAKE_INSTALL_PREFIX}/lib64")
+    if (LIB64FOUND)
+        set(LIBSUFFIX 64)
+    else()
+        set(LIBSUFFIX "")
+    endif()
+else()
+    set(LIBSUFFIX "")
+endif()
+
+if(KOLAB_LIB_INSTALL_DIR)
+    message("KOLAB_LIB_INSTALL_DIR specified manually")
+else()
+    set(KOLAB_LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIBSUFFIX}")
+endif()
+message("KOLAB_LIB_INSTALL_DIR: ${KOLAB_LIB_INSTALL_DIR}")
+
+if(KOLAB_BIN_INSTALL_DIR)
+    message("KOLAB_BIN_INSTALL_DIR specified manually")
+else()
+    set(KOLAB_BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
+endif()
+message("KOLAB_BIN_INSTALL_DIR: ${KOLAB_BIN_INSTALL_DIR}")
+
+set(KOLAB_INSTALL_DIRECTORIES  RUNTIME DESTINATION "${KOLAB_BIN_INSTALL_DIR}"
+                                  LIBRARY DESTINATION "${KOLAB_LIB_INSTALL_DIR}"
+                                  ARCHIVE DESTINATION "${KOLAB_LIB_INSTALL_DIR}" COMPONENT Devel )
+
+set(KOLAB_HEADER_INSTALL_DIR  "${INCLUDE_INSTALL_DIR}/kolab")
diff --git a/libkolab/CMakeLists.txt b/libkolab/CMakeLists.txt
index 9ab3b44..71d9e47 100644
--- a/libkolab/CMakeLists.txt
+++ b/libkolab/CMakeLists.txt
@@ -2,6 +2,8 @@ project(libkolab)
 
 cmake_minimum_required(VERSION 2.6)
 
+include( ../cmake/modules/FindKolabInternal.cmake )
+
 find_package(Qt4 REQUIRED)
 find_package(KDE4 REQUIRED)
 
@@ -29,17 +31,17 @@ add_subdirectory(kolabformatV2)
 
 add_library(kolab SHARED kolabformat/kolabobject.cpp mime/mimeutils.cpp conversion/kcalconversion.cpp)
 target_link_libraries(kolab kolabformatV2  ${KOLABXML} kcalcore kmime ${QT_QTCORE_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBRARY} kabc akonadi-kde ${KDE4_KIO_LIBRARY})
-set_target_properties(kolab PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
+set_target_properties(kolab PROPERTIES VERSION 0.1 SOVERSION 0)
 
-install(TARGETS kolab EXPORT kdepimlibsLibraryTargets ${INSTALL_TARGETS_DEFAULT_ARGS})
+install(TARGETS kolab EXPORT libkolabLibraryTargets ${KOLAB_INSTALL_DIRECTORIES})
 
 install( FILES
     kolab_export.h
-    DESTINATION ${INCLUDE_INSTALL_DIR}/kolab COMPONENT Devel)
+    DESTINATION ${KOLAB_HEADER_INSTALL_DIR} COMPONENT Devel)
 
 install( FILES
     kolabformat/kolabobject.h
     conversion/kcalconversion.h
-    DESTINATION ${INCLUDE_INSTALL_DIR}/kolab COMPONENT Devel)
+    DESTINATION ${KOLAB_HEADER_INSTALL_DIR} COMPONENT Devel)
 
 add_subdirectory(tests)
diff --git a/libkolab/akonadi-version.h.cmake b/libkolab/akonadi-version.h.cmake
new file mode 100644
index 0000000..58c028e
--- /dev/null
+++ b/libkolab/akonadi-version.h.cmake
@@ -0,0 +1,25 @@
+/*
+    This file is part of kdepim.
+    Copyright (C) 2009 Christophe Giboudeaux  <cgiboudeaux at gmail.com>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef AKONADI_VERSION_H
+#define AKONADI_VERSION_H
+
+#define AKONADI_VERSION "@AKONADI_VERSION@"
+
+#endif // AKONADI_VERSION_H
\ No newline at end of file


commit 764463401c1d7628be7516bc2d36ee90d0545c8a
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Fri Mar 23 11:09:36 2012 +0100

    Use libuuid as fallback for old boost versions.

diff --git a/c++/CMakeLists.txt b/c++/CMakeLists.txt
index f9daf30..0fb586e 100644
--- a/c++/CMakeLists.txt
+++ b/c++/CMakeLists.txt
@@ -15,6 +15,15 @@ endif()
 
 find_package(Boost COMPONENTS thread REQUIRED)
 
+if (${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.42)
+    find_library(UUID NAMES 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)
diff --git a/c++/lib/CMakeLists.txt b/c++/lib/CMakeLists.txt
index 5fa9455..7b7e163 100644
--- a/c++/lib/CMakeLists.txt
+++ b/c++/lib/CMakeLists.txt
@@ -6,7 +6,7 @@ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wp,-D_FORTIFY_SOURCE=2 -O2" ) #a
 #Library with serialization/deserialization code and kolab-containers
 add_library(kolabxml SHARED kolabformat.cpp kolabcontainers.cpp kolabnote.cpp kolabevent.cpp kolabtodo.cpp kolabjournal.cpp kolabcontact.cpp utils.cpp base64.cpp ../compiled/XMLParserWrapper.cpp ../compiled/grammar-input-stream.cxx ${SCHEMA_SOURCEFILES})
 
-target_link_libraries(kolabxml ${XERCES_C} ${Boost_LIBRARIES})
+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.
 set_target_properties(kolabxml PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wl,--no-undefined")
diff --git a/c++/lib/utils.cpp b/c++/lib/utils.cpp
index f49b37b..8096f54 100644
--- a/c++/lib/utils.cpp
+++ b/c++/lib/utils.cpp
@@ -17,8 +17,16 @@
 
 #include "utils.h"
 #include <string>
+
+#include <boost/version.hpp>
+
+#if BOOST_VERSION >= 104200
 #include <boost/uuid/uuid.hpp>
 #include <boost/uuid/uuid_io.hpp>
+#else
+#include <uuid/uuid.h>
+#endif
+
 #include <boost/lexical_cast.hpp>
 #include <boost/thread.hpp>
 #include <time.h>
@@ -93,8 +101,16 @@ std::string createdUid()
 std::string getUID(const std::string &s)
 {
     if (s.empty()) {
+#if BOOST_VERSION >= 104200
         boost::uuids::uuid u; // initialize uuid
         return boost::uuids::to_string(u);
+#else
+        uuid_t u;
+        uuid_generate(u);
+        char out[37];
+        uuid_unparse(u,out);
+        return std::string(out, 36); //We don't need the terminating \0
+#endif
     }
     return s;
 }
diff --git a/c++/tests/conversiontest.cpp b/c++/tests/conversiontest.cpp
index 0ab7047..0bed229 100644
--- a/c++/tests/conversiontest.cpp
+++ b/c++/tests/conversiontest.cpp
@@ -258,6 +258,13 @@ void ConversionTest::threadLocalTest()
     t2.join();
 }
 
+void ConversionTest::uuidGeneratorTest()
+{
+    const std::string &s = getUID();
+    std::cout << s << std::endl;
+    QVERIFY(!s.empty());
+    QCOMPARE(s.size(), (std::size_t)36ul);
+}
 
 
 
diff --git a/c++/tests/conversiontest.h b/c++/tests/conversiontest.h
index 516470c..b586ed6 100644
--- a/c++/tests/conversiontest.h
+++ b/c++/tests/conversiontest.h
@@ -40,6 +40,8 @@ class ConversionTest : public QObject
     void geoUriTest();
     
     void threadLocalTest();
+    
+    void uuidGeneratorTest();
 };
 
 #endif // CONVERSIONTEST_H


commit 685a2b559f149db4aefe027f58c0124a7585f988
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Fri Mar 23 10:26:40 2012 +0100

    Don't use the namespace of a specific xerces version.

diff --git a/c++/compiled/XMLParserWrapper.cpp b/c++/compiled/XMLParserWrapper.cpp
index 169599a..dffff8d 100644
--- a/c++/compiled/XMLParserWrapper.cpp
+++ b/c++/compiled/XMLParserWrapper.cpp
@@ -226,7 +226,7 @@ void XMLParserWrapper::init()
     
 }
 
-xsd::cxx::xml::dom::auto_ptr< xercesc_3_1::DOMDocument > XMLParserWrapper::parseFile(const std::string& url)
+xsd::cxx::xml::dom::auto_ptr< xercesc::DOMDocument > XMLParserWrapper::parseFile(const std::string& url)
 {
     try {
         std::ifstream ifs;
@@ -237,10 +237,10 @@ xsd::cxx::xml::dom::auto_ptr< xercesc_3_1::DOMDocument > XMLParserWrapper::parse
     {
         std::cerr << ": unable to open or read failure" << std::endl;
     }
-    return xsd::cxx::xml::dom::auto_ptr< xercesc_3_1::DOMDocument >();
+    return xsd::cxx::xml::dom::auto_ptr< xercesc::DOMDocument >();
 }
 
-xsd::cxx::xml::dom::auto_ptr< xercesc_3_1::DOMDocument > XMLParserWrapper::parseString(const std::string& s)
+xsd::cxx::xml::dom::auto_ptr< xercesc::DOMDocument > XMLParserWrapper::parseString(const std::string& s)
 {
     std::istringstream is(s);
     return parse(is, ""); //TODO set identifier?
diff --git a/c++/lib/kolabconversions.h b/c++/lib/kolabconversions.h
index c762044..4871acd 100644
--- a/c++/lib/kolabconversions.h
+++ b/c++/lib/kolabconversions.h
@@ -104,12 +104,12 @@ boost::shared_ptr<Kolab::Note> deserializeObject(const std::string& s, bool isUr
     try {
         std::auto_ptr<KolabXSD::Note> note;
         if (isUrl) {
-            xsd::cxx::xml::dom::auto_ptr <xercesc_3_1::DOMDocument > doc = XMLParserWrapper::inst().parseFile(s);
+            xsd::cxx::xml::dom::auto_ptr <xercesc::DOMDocument > doc = XMLParserWrapper::inst().parseFile(s);
             if (doc.get()) {
                 note = KolabXSD::note(doc);
             }
         } else {
-            xsd::cxx::xml::dom::auto_ptr <xercesc_3_1::DOMDocument > doc = XMLParserWrapper::inst().parseString(s);
+            xsd::cxx::xml::dom::auto_ptr <xercesc::DOMDocument > doc = XMLParserWrapper::inst().parseString(s);
             if (doc.get()) {
                 note = KolabXSD::note(doc);
             }
diff --git a/c++/lib/xcalconversions.h b/c++/lib/xcalconversions.h
index 526af01..601acea 100644
--- a/c++/lib/xcalconversions.h
+++ b/c++/lib/xcalconversions.h
@@ -1644,12 +1644,12 @@ typename T::IncidencePtr deserializeIncidence(const std::string& s, bool isUrl)
     try {
         std::auto_ptr<icalendar_2_0::IcalendarType> icalendar;
         if (isUrl) {
-            xsd::cxx::xml::dom::auto_ptr <xercesc_3_1::DOMDocument > doc = XMLParserWrapper::inst().parseFile(s);
+            xsd::cxx::xml::dom::auto_ptr <xercesc::DOMDocument > doc = XMLParserWrapper::inst().parseFile(s);
             if (doc.get()) {
                 icalendar = icalendar_2_0::icalendar(doc);
             }
         } else {
-            xsd::cxx::xml::dom::auto_ptr <xercesc_3_1::DOMDocument > doc = XMLParserWrapper::inst().parseString(s);
+            xsd::cxx::xml::dom::auto_ptr <xercesc::DOMDocument > doc = XMLParserWrapper::inst().parseString(s);
             if (doc.get()) {
                 icalendar = icalendar_2_0::icalendar(doc);
             }
diff --git a/c++/lib/xcardconversions.h b/c++/lib/xcardconversions.h
index 310d444..0be6f0a 100644
--- a/c++/lib/xcardconversions.h
+++ b/c++/lib/xcardconversions.h
@@ -1043,12 +1043,12 @@ boost::shared_ptr<T> deserializeCard(const std::string& s, bool isUrl)
     try {
         std::auto_ptr<vcard_4_0::VcardsType> vcards;
         if (isUrl) {
-            xsd::cxx::xml::dom::auto_ptr <xercesc_3_1::DOMDocument > doc = XMLParserWrapper::inst().parseFile(s);
+            xsd::cxx::xml::dom::auto_ptr <xercesc::DOMDocument > doc = XMLParserWrapper::inst().parseFile(s);
             if (doc.get()) {
                 vcards = vcard_4_0::vcards(doc);
             }
         } else {
-            xsd::cxx::xml::dom::auto_ptr <xercesc_3_1::DOMDocument > doc = XMLParserWrapper::inst().parseString(s);
+            xsd::cxx::xml::dom::auto_ptr <xercesc::DOMDocument > doc = XMLParserWrapper::inst().parseString(s);
             if (doc.get()) {
                 vcards = vcard_4_0::vcards(doc);
             }





More information about the commits mailing list