summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2012-03-28 18:19:04 (GMT)
committerChristian Mollekopf <chrigi_1@fastmail.fm>2012-03-28 18:19:04 (GMT)
commitedad5da5eef5b49457905f1ee525a3584e244d40 (patch)
tree0cacce3b5f0f257f1be87e86a217b704a72b22ae
parent2a4a3c925d0f5d44f1192440f86412b99cc6ad9a (diff)
downloadlibkolabxml-edad5da5eef5b49457905f1ee525a3584e244d40.tar.gz
added make dist, set correct soversion, no hardcoded version strings anymore.
All version numbers are now controlled form the toplevel cmake file.
-rw-r--r--CMakeLists.txt17
-rw-r--r--libkolabxml-version.h.cmake26
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/global_definitions.h5
-rw-r--r--src/kolabconversions.h2
-rw-r--r--src/xcalconversions.h2
-rw-r--r--src/xcardconversions.h2
-rw-r--r--tests/bindingstest.cpp4
8 files changed, 50 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d007252..ac07b71 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
project(libkolabxml)
+
cmake_minimum_required(VERSION 2.6)
# only available from cmake-2.8.0
@@ -13,6 +14,16 @@ if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 7 AND
cmake_policy(SET CMP0017 NEW)
endif()
+set (KOLABXML_VERSION_MAJOR 0)
+set (KOLABXML_VERSION_MINOR 3)
+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")
+
+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 )
@@ -136,3 +147,9 @@ else()
message("Qt libraries have not been found, not building tests")
endif()
+set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${KOLABXML_VERSION})
+#make dist requires a tag with ${ARCHIVE_NAME} (e.g. libkolabxml-0.2.0)
+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})
diff --git a/libkolabxml-version.h.cmake b/libkolabxml-version.h.cmake
new file mode 100644
index 0000000..d91e377
--- /dev/null
+++ b/libkolabxml-version.h.cmake
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2012 Christian Mollekopf <mollekopf@kolabsys.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef LIBKOLABXML_VERSION_H
+#define LIBKOLABXML_VERSION_H
+
+#define KOLAB_LIBNAME "@CMAKE_PROJECT_NAME@"
+#define KOLAB_LIB_VERSION "@KOLABXML_VERSION@"
+#define KOLAB_LIB_VERSION_STRING "@KOLABXML_VERSION_STRING@"
+#define KOLAB_FORMAT_VERSION "@KOLAB_FORMAT_VERSION@"
+
+#endif
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cedf061..cc6c0ed 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -10,7 +10,7 @@ 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)
+set_target_properties(kolabxml PROPERTIES VERSION ${KOLABXML_VERSION} SOVERSION 0)
install(TARGETS kolabxml ${KOLAB_INSTALL_DIRECTORIES})
diff --git a/src/global_definitions.h b/src/global_definitions.h
index 2aa36e8..0860843 100644
--- a/src/global_definitions.h
+++ b/src/global_definitions.h
@@ -18,13 +18,10 @@
#ifndef GLOBAL_DEFINITIONS_H
#define GLOBAL_DEFINITIONS_H
#include <string>
+#include "libkolabxml-version.h"
namespace Kolab {
-const char* const KOLAB_LIBNAME = "libkolabxml";
-const char* const KOLAB_LIB_VERSION = "0.1";
-const char* const KOLAB_FORMAT_VERSION = "3.0dev1";
-
enum ErrorSeverity {
NoError,
Warning, //Warning, error could be corrected, object can be used without dataloss
diff --git a/src/kolabconversions.h b/src/kolabconversions.h
index 4871acd..cca2775 100644
--- a/src/kolabconversions.h
+++ b/src/kolabconversions.h
@@ -51,7 +51,7 @@ std::string serializeObject(const Kolab::Note &note, const std::string prod = st
created = fromDateTime(getCurrentTime());
}
- KolabXSD::Note n(getUID(note.uid()), prod+KOLAB_LIBNAME+KOLAB_LIB_VERSION, created, fromDateTime(getCurrentTime()));
+ KolabXSD::Note n(getUID(note.uid()), prod+KOLAB_LIB_VERSION_STRING, created, fromDateTime(getCurrentTime()));
if (!note.categories().empty()) {
KolabXSD::Note::categories_sequence categories;
diff --git a/src/xcalconversions.h b/src/xcalconversions.h
index 601acea..3829cc9 100644
--- a/src/xcalconversions.h
+++ b/src/xcalconversions.h
@@ -1607,7 +1607,7 @@ std::string serializeIncidence(const typename T::IncidenceType &incidence, const
VcalendarType::components_type components;
T::addIncidence(components, inc);
- VcalendarType::properties_type::prodid_type prodid(productid+KOLAB_LIBNAME+KOLAB_LIB_VERSION); //FIXME own version field for lib version
+ VcalendarType::properties_type::prodid_type prodid(productid+KOLAB_LIB_VERSION_STRING); //FIXME own version field for lib version
VcalendarType::properties_type::version_type version(XCAL_VERSION);
VcalendarType::properties_type::x_kolab_version_type x_kolab_version(KOLAB_FORMAT_VERSION);
diff --git a/src/xcardconversions.h b/src/xcardconversions.h
index b3c1577..30da824 100644
--- a/src/xcardconversions.h
+++ b/src/xcardconversions.h
@@ -719,7 +719,7 @@ std::string serializeCard(const T &card, const std::string prod = std::string())
vcard_4_0::vcard::uid_type uid(Shared::toURN(getUID(card.uid())));
setCreatedUid(Shared::fromURN(uid.uri()));
vcard_4_0::vcard::x_kolab_version_type kolab_version(KOLAB_FORMAT_VERSION);
- vcard_4_0::vcard::prodid_type prodid(prod+KOLAB_LIBNAME+KOLAB_LIB_VERSION);
+ vcard_4_0::vcard::prodid_type prodid(prod+KOLAB_LIB_VERSION_STRING);
vcard_4_0::vcard::rev_type rev(fromDateTime(getCurrentTime()));
vcard_4_0::vcard::kind_type kind(getType<T>());
vcard_4_0::vcard::fn_type fn(card.name());
diff --git a/tests/bindingstest.cpp b/tests/bindingstest.cpp
index c1f6a20..efae01f 100644
--- a/tests/bindingstest.cpp
+++ b/tests/bindingstest.cpp
@@ -509,8 +509,8 @@ void BindingsTest::versionTest()
std::string result = Kolab::writeTodo(ev);
Kolab::Todo e = Kolab::readTodo(result, false);
- QCOMPARE(Kolab::productId(), std::string(Kolab::KOLAB_LIBNAME) + std::string(Kolab::KOLAB_LIB_VERSION));
- QCOMPARE(Kolab::xKolabVersion(), std::string(Kolab::KOLAB_FORMAT_VERSION));
+ QCOMPARE(Kolab::productId(), std::string(KOLAB_LIB_VERSION_STRING));
+ QCOMPARE(Kolab::xKolabVersion(), std::string(KOLAB_FORMAT_VERSION));
QCOMPARE(Kolab::xCalVersion(), std::string("2.0"));
}