summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2013-10-14 14:18:11 (GMT)
committerChristian Mollekopf <mollekopf@kolabsys.com>2013-10-14 14:18:11 (GMT)
commitf4f632de0e135acdce17043fe9730e96bf683e6c (patch)
treeaf222855c32bc4e437dc7229f338886f5d6de7da
parent79f416f2ca4e40c1e569599d1897f144464c2897 (diff)
downloadlibcalendaring-f4f632de0e135acdce17043fe9730e96bf683e6c.tar.gz
Updated the buildsystem to export it's version using the usual cmake config approach.
Additinoally the kdepimlibs version is exported for workarounds in libkolab/kolab-utils. This replaces the FindLibcalendaring.cmake modules in libkolab and kolab-utils.
-rw-r--r--CMakeLists.txt53
-rw-r--r--cmake/modules/COPYING-CMAKE-SCRIPTS22
-rw-r--r--cmake/modules/LibcalendaringConfig.cmake.in21
-rw-r--r--cmake/modules/LibcalendaringConfigVersion.cmake.in14
-rw-r--r--cmake/modules/MacroLogFeature.cmake157
5 files changed, 240 insertions, 27 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 83a1f44..591b10c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,18 +1,27 @@
+project(Libcalendaring)
+
cmake_minimum_required(VERSION 2.6)
-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+
+set(Libcalendaring_MODULE_DIR ${Libcalendaring_SOURCE_DIR}/cmake/modules)
+set(CMAKE_MODULE_PATH ${Libcalendaring_MODULE_DIR})
+
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wl,--no-undefined" )
-set(LIBCALENDARING_VERSION_MAJOR 0)
-set(LIBCALENDARING_VERSION_MINOR 3)
+set(Libcalendaring_VERSION_MAJOR 0)
+set(Libcalendaring_VERSION_MINOR 3)
-set(KDE_NON_GENERIC_LIB_VERSION ${LIBCALENDARING_VERSION_MAJOR}.${LIBCALENDARING_VERSION_MINOR})
-set(KDE_NON_GENERIC_LIB_SOVERSION ${LIBCALENDARING_VERSION_MAJOR})
+set(KdepimLibs_VERSION_MAJOR 4)
+set(KdepimLibs_VERSION_MINOR 10)
+set(KdepimLibs_VERSION_PATCH 0)
-set(ECM_VERSION_STRING ${LIBCALENDARING_VERSION_MAJOR}.${LIBCALENDARING_VERSION_MINOR})
-set(ECM_SOVERSION ${LIBCALENDARING_VERSION_MAJOR})
+set(KDE_NON_GENERIC_LIB_VERSION ${Libcalendaring_VERSION_MAJOR}.${Libcalendaring_VERSION_MINOR})
+set(KDE_NON_GENERIC_LIB_SOVERSION ${Libcalendaring_VERSION_MAJOR})
-set(GENERIC_LIB_VERSION ${LIBCALENDARING_VERSION_MAJOR}.${LIBCALENDARING_VERSION_MINOR})
-set(GENERIC_LIB_SOVERSION ${LIBCALENDARING_VERSION_MAJOR})
+set(ECM_VERSION_STRING ${Libcalendaring_VERSION_MAJOR}.${Libcalendaring_VERSION_MINOR})
+set(ECM_SOVERSION ${Libcalendaring_VERSION_MAJOR})
+
+set(GENERIC_LIB_VERSION ${Libcalendaring_VERSION_MAJOR}.${Libcalendaring_VERSION_MINOR})
+set(GENERIC_LIB_SOVERSION ${Libcalendaring_VERSION_MAJOR})
add_definitions(-DKDE_NO_DBUS)
add_definitions(-DKDE_NO_TIMEZONED)
@@ -40,6 +49,8 @@ set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION ${BIN_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)
+set(CMAKECONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/Libcalendaring)
+
# set(CMAKE_AUTOMOC ON)
add_subdirectory(kdecore)
@@ -54,21 +65,9 @@ add_subdirectory(kcalutils)
install( FILES kdemacros.h
DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
-# set(static_libs ${CMAKE_CURRENT_BINARY_DIR}/kdecore/libcalendaring-kdecore.a
-# ${CMAKE_CURRENT_BINARY_DIR}/kmime/libcalendaring-kmime
-# ${CMAKE_CURRENT_BINARY_DIR}/kcalcore/libcalendaring-kcalcore
-# ${CMAKE_CURRENT_BINARY_DIR}/kimap/libcalendaring-kimap
-# )
-# set(libs calendaring-kdecore
-# calendaring-kmime
-# calendaring-kcalcore
-# calendaring-kimap
-# )
-#
-# add_library(calendaring SHARED dummy.cpp)
-# set_target_properties(calendaring PROPERTIES STATIC_LIBRARY_FLAGS "${CMAKE_CURRENT_BINARY_DIR}/kdecore/libcalendaring-kdecore.a ${CMAKE_CURRENT_BINARY_DIR}/kmime/libcalendaring-kmime.a ${CMAKE_CURRENT_BINARY_DIR}/kcalcore/libcalendaring-kcalcore.a ${CMAKE_CURRENT_BINARY_DIR}/kimap/libcalendaring-kimap.a")
-# target_link_libraries(calendaring LINK_INTERFACE_LIBRARIES ${libs} )
-# target_link_libraries(calendaring ${libs})
-# message("${libs}")
-# include(MergeStaticLibraries)
-# MERGE_STATIC_LIBS(calendaring ${libs})
+configure_file(${Libcalendaring_MODULE_DIR}/LibcalendaringConfig.cmake.in ${Libcalendaring_BINARY_DIR}/LibcalendaringConfig.cmake @ONLY )
+configure_file(${Libcalendaring_MODULE_DIR}/LibcalendaringConfigVersion.cmake.in ${Libcalendaring_BINARY_DIR}/LibcalendaringConfigVersion.cmake @ONLY )
+# Install these two files into the same directory as the generated exports-file.
+install(FILES ${Libcalendaring_BINARY_DIR}/LibcalendaringConfig.cmake ${Libcalendaring_BINARY_DIR}/LibcalendaringConfigVersion.cmake
+ DESTINATION ${CMAKECONFIG_INSTALL_DIR} )
+
diff --git a/cmake/modules/COPYING-CMAKE-SCRIPTS b/cmake/modules/COPYING-CMAKE-SCRIPTS
new file mode 100644
index 0000000..4b41776
--- /dev/null
+++ b/cmake/modules/COPYING-CMAKE-SCRIPTS
@@ -0,0 +1,22 @@
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/cmake/modules/LibcalendaringConfig.cmake.in b/cmake/modules/LibcalendaringConfig.cmake.in
new file mode 100644
index 0000000..8b693e5
--- /dev/null
+++ b/cmake/modules/LibcalendaringConfig.cmake.in
@@ -0,0 +1,21 @@
+get_filename_component(Libcalendaring_CMAKE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) #get the directory where this *Config.cmake file is installed
+
+# set the version
+set(Libcalendaring_VERSION_MAJOR @Libcalendaring_VERSION_MAJOR@)
+set(Libcalendaring_VERSION_MINOR @Libcalendaring_VERSION_MINOR@)
+set(Libcalendaring_VERSION_PATCH @Libcalendaring_VERSION_PATCH@)
+set(Libcalendaring_VERSION ${Libcalendaring_VERSION_MAJOR}.${Libcalendaring_VERSION_MINOR}.${Libcalendaring_VERSION_PATCH} )
+
+set(KdepimLibs_VERSION_MAJOR @KdepimLibs_VERSION_MAJOR@)
+set(KdepimLibs_VERSION_MINOR @KdepimLibs_VERSION_MINOR@)
+set(KdepimLibs_VERSION_PATCH @KdepimLibs_VERSION_PATCH@)
+
+# Set the include directory
+set(Libcalendaring_INCLUDES "@CONF_INCLUDE_DIRS@")
+set(Libcalendaring_INCLUDE_DIRS ${Libcalendaring_INCLUDES})
+
+# import the exported targets
+#include(${Libcalendaring_CMAKE_DIR}/LibcalendaringTargets.cmake)
+
+# set the expected library variable
+set(Libcalendaring_LIBRARIES calendaring-kdecore calendaring-kcalcore calendaring-kmime calendaring-kimap calendating-kabc calendaring-akonadi-notes calendaring-kcalutils calendaring-kpimutils)
diff --git a/cmake/modules/LibcalendaringConfigVersion.cmake.in b/cmake/modules/LibcalendaringConfigVersion.cmake.in
new file mode 100644
index 0000000..6d3b67b
--- /dev/null
+++ b/cmake/modules/LibcalendaringConfigVersion.cmake.in
@@ -0,0 +1,14 @@
+# Sets PACKAGE_VERSION_EXACT if the current version string and the requested
+# version string are exactly the same and it sets PACKAGE_VERSION_COMPATIBLE
+# if the current version is >= requested version.
+
+set(PACKAGE_VERSION @Libcalendaring_VERSION_MAJOR@.@Libcalendaring_VERSION_MINOR@.@Libcalendaring_VERSION_PATCH@)
+
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+endif("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
diff --git a/cmake/modules/MacroLogFeature.cmake b/cmake/modules/MacroLogFeature.cmake
new file mode 100644
index 0000000..45e27b6
--- /dev/null
+++ b/cmake/modules/MacroLogFeature.cmake
@@ -0,0 +1,157 @@
+# This file defines the Feature Logging macros.
+#
+# MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]])
+# Logs the information so that it can be displayed at the end
+# of the configure run
+# VAR : TRUE or FALSE, indicating whether the feature is supported
+# FEATURE: name of the feature, e.g. "libjpeg"
+# DESCRIPTION: description what this feature provides
+# URL: home page
+# REQUIRED: TRUE or FALSE, indicating whether the featue is required
+# MIN_VERSION: minimum version number. empty string if unneeded
+# COMMENTS: More info you may want to provide. empty string if unnecessary
+#
+# MACRO_DISPLAY_FEATURE_LOG()
+# Call this to display the collected results.
+# Exits CMake with a FATAL error message if a required feature is missing
+#
+# Example:
+#
+# INCLUDE(MacroLogFeature)
+#
+# FIND_PACKAGE(JPEG)
+# MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "")
+# ...
+# MACRO_DISPLAY_FEATURE_LOG()
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+# Copyright (c) 2006, Allen Winter, <winter@kde.org>
+# Copyright (c) 2009, Sebastian Trueg, <trueg@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+IF (NOT _macroLogFeatureAlreadyIncluded)
+ SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
+ IF (EXISTS ${_file})
+ FILE(REMOVE ${_file})
+ ENDIF (EXISTS ${_file})
+
+ SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
+ IF (EXISTS ${_file})
+ FILE(REMOVE ${_file})
+ ENDIF (EXISTS ${_file})
+
+ SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
+ IF (EXISTS ${_file})
+ FILE(REMOVE ${_file})
+ ENDIF (EXISTS ${_file})
+
+ SET(_macroLogFeatureAlreadyIncluded TRUE)
+
+ INCLUDE(FeatureSummary)
+
+ENDIF (NOT _macroLogFeatureAlreadyIncluded)
+
+
+MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments)
+
+ STRING(TOUPPER "${ARGV4}" _required)
+ SET(_minvers "${ARGV5}")
+ SET(_comments "${ARGV6}")
+
+ IF (${_var})
+ SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
+ ELSE (${_var})
+ IF ("${_required}" STREQUAL "TRUE")
+ SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
+ ELSE ("${_required}" STREQUAL "TRUE")
+ SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
+ ENDIF ("${_required}" STREQUAL "TRUE")
+ ENDIF (${_var})
+
+ SET(_logtext " * ${_package}")
+
+ IF (NOT ${_var})
+ IF (${_minvers} MATCHES ".*")
+ SET(_logtext "${_logtext} (${_minvers} or higher)")
+ ENDIF (${_minvers} MATCHES ".*")
+ SET(_logtext "${_logtext} <${_url}>\n ")
+ ELSE (NOT ${_var})
+ SET(_logtext "${_logtext} - ")
+ ENDIF (NOT ${_var})
+
+ SET(_logtext "${_logtext}${_description}")
+
+ IF (NOT ${_var})
+ IF (${_comments} MATCHES ".*")
+ SET(_logtext "${_logtext}\n ${_comments}")
+ ENDIF (${_comments} MATCHES ".*")
+# SET(_logtext "${_logtext}\n") #double-space missing features?
+ ENDIF (NOT ${_var})
+
+ FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n")
+
+ IF(COMMAND SET_PACKAGE_INFO) # in FeatureSummary.cmake since CMake 2.8.3
+ SET_PACKAGE_INFO("${_package}" "\"${_description}\"" "${_url}" "\"${_comments}\"")
+ ENDIF(COMMAND SET_PACKAGE_INFO)
+
+ENDMACRO(MACRO_LOG_FEATURE)
+
+
+MACRO(MACRO_DISPLAY_FEATURE_LOG)
+ IF(COMMAND FEATURE_SUMMARY) # in FeatureSummary.cmake since CMake 2.8.3
+ FEATURE_SUMMARY(FILENAME ${CMAKE_CURRENT_BINARY_DIR}/FindPackageLog.txt
+ WHAT ALL)
+ ENDIF(COMMAND FEATURE_SUMMARY)
+
+ SET(_missingFile ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
+ SET(_enabledFile ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
+ SET(_disabledFile ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
+
+ IF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile})
+ SET(_printSummary TRUE)
+ ENDIF (EXISTS ${_missingFile} OR EXISTS ${_enabledFile} OR EXISTS ${_disabledFile})
+
+ IF(_printSummary)
+ SET(_missingDeps 0)
+ IF (EXISTS ${_enabledFile})
+ FILE(READ ${_enabledFile} _enabled)
+ FILE(REMOVE ${_enabledFile})
+ SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n-----------------------------------------------------------------------------\n${_enabled}")
+ ENDIF (EXISTS ${_enabledFile})
+
+
+ IF (EXISTS ${_disabledFile})
+ SET(_missingDeps 1)
+ FILE(READ ${_disabledFile} _disabled)
+ FILE(REMOVE ${_disabledFile})
+ SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n-----------------------------------------------------------------------------\n${_disabled}")
+ ENDIF (EXISTS ${_disabledFile})
+
+
+ IF (EXISTS ${_missingFile})
+ SET(_missingDeps 1)
+ FILE(READ ${_missingFile} _requirements)
+ SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- You must install these packages before continuing.\n-----------------------------------------------------------------------------\n${_requirements}")
+ FILE(REMOVE ${_missingFile})
+ SET(_haveMissingReq 1)
+ ENDIF (EXISTS ${_missingFile})
+
+
+ IF (NOT ${_missingDeps})
+ SET(_summary "${_summary}\n-----------------------------------------------------------------------------\n-- Congratulations! All external packages have been found.")
+ ENDIF (NOT ${_missingDeps})
+
+
+ MESSAGE(${_summary})
+ MESSAGE("-----------------------------------------------------------------------------\n")
+
+
+ IF(_haveMissingReq)
+ MESSAGE(FATAL_ERROR "Exiting: Missing Requirements")
+ ENDIF(_haveMissingReq)
+
+ ENDIF(_printSummary)
+
+ENDMACRO(MACRO_DISPLAY_FEATURE_LOG)