summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2012-04-21 15:12:07 (GMT)
committerChristian Mollekopf <mollekopf@kolabsys.com>2012-04-21 15:12:07 (GMT)
commit13f2f6138eb63401579279139e226dc3165162d4 (patch)
tree9cba6e061c3c078c66e53a8ae4610bd25e224bed /cmake
parentafb5c81d35e007c25e566bb0b8b57cc95a6cf38d (diff)
downloadlibkolabxml-13f2f6138eb63401579279139e226dc3165162d4.tar.gz
Revamp of buildsystem to use cmake config files and avoid several other quirks.
- Find files should never be installed, that is what configure files are for. - Variables which should be configurable should be added using the CACHE option, making the available in the cmake cache. They can still be overridden as ususal. - The libdir suffix can now be specified using -DLIB_INSTALL_DIR_SUFFIX=64. - The builddirectory is no longer hardcoded.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/CMakeLists.txt5
-rw-r--r--cmake/modules/FindKolabInternal.cmake58
-rw-r--r--cmake/modules/FindLibkolabxmlDependencies.cmake41
-rw-r--r--cmake/modules/LibkolabxmlConfig.cmake.in18
-rw-r--r--cmake/modules/LibkolabxmlConfigVersion.cmake.in14
5 files changed, 73 insertions, 63 deletions
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
deleted file mode 100644
index 94ebe09..0000000
--- a/cmake/modules/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-
-include(FindKolabInternal.cmake)
-
-install(FILES FindKolabInternal.cmake DESTINATION ${KOLAB_CMAKE_MODULE_INSTALL_DIR} )
-
diff --git a/cmake/modules/FindKolabInternal.cmake b/cmake/modules/FindKolabInternal.cmake
deleted file mode 100644
index b187875..0000000
--- a/cmake/modules/FindKolabInternal.cmake
+++ /dev/null
@@ -1,58 +0,0 @@
-
-# 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
-# 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
-
-if (LIB_INSTALL_DIR)
- set(KOLAB_LIB_INSTALL_DIR ${LIB_INSTALL_DIR})
-else ()
- 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()
-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 )
-
-
-if(KOLAB_HEADER_INSTALL_DIR)
- message("KOLAB_HEADER_INSTALL_DIR specified manually")
-else()
- set(KOLAB_HEADER_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/kolab")
-endif()
-message("KOLAB_HEADER_INSTALL_DIR: ${KOLAB_HEADER_INSTALL_DIR}")
-
-set(KOLAB_DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/apps")
-set(KOLAB_CMAKE_MODULE_INSTALL_DIR ${KOLAB_DATA_INSTALL_DIR}/cmake/modules )
diff --git a/cmake/modules/FindLibkolabxmlDependencies.cmake b/cmake/modules/FindLibkolabxmlDependencies.cmake
new file mode 100644
index 0000000..5c16f6a
--- /dev/null
+++ b/cmake/modules/FindLibkolabxmlDependencies.cmake
@@ -0,0 +1,41 @@
+# Find some dependencies
+# Instead of having multiple findscripts, we use a single to find everything we need
+#
+find_package(PkgConfig)
+include(FindPackageHandleStandardArgs)
+
+if (${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.42)
+ find_library(UUID NAMES ossp-uuid)
+ find_package_handle_standard_args(UUID DEFAULT_MSG
+ UUID)
+ if (UUID)
+ set(UUID_LIBRARY_FOUND TRUE)
+ endif()
+else()
+ #Make sure that we either have the boost or ossp uuid lib
+ set(UUID_LIBRARY_FOUND TRUE)
+endif()
+
+find_program(XSDCXX xsdcxx /usr/bin/)
+find_package_handle_standard_args(XSDCXX DEFAULT_MSG
+ XSDCXX)
+
+find_library(XERCES_C NAMES xerces-c xerces-c_2)
+find_package_handle_standard_args(Xerces DEFAULT_MSG
+ XERCES_C)
+
+find_program(SWIG swig /usr/bin/)
+if(SWIG)
+ set(SWIG_FOUND ON)
+ message("SWIG found")
+endif()
+
+find_program(XSDBIN xsdbin)
+if(XSDBIN)
+ set(XSDBIN_FOUND ON)
+ message("XSDBIN found")
+endif()
+
+#abort if any of the requireds are missing
+find_package_handle_standard_args(LibkolabxmlDependencies DEFAULT_MSG
+ UUID_LIBRARY_FOUND XSDCXX XERCES_C)
diff --git a/cmake/modules/LibkolabxmlConfig.cmake.in b/cmake/modules/LibkolabxmlConfig.cmake.in
new file mode 100644
index 0000000..2a6484a
--- /dev/null
+++ b/cmake/modules/LibkolabxmlConfig.cmake.in
@@ -0,0 +1,18 @@
+get_filename_component(myDir ${CMAKE_CURRENT_LIST_FILE} PATH) # get the directory where I myself am
+get_filename_component(rootDir ${myDir}/@relInstallDir@ ABSOLUTE) # get the chosen install prefix
+
+# set the version of myself
+set(Libkolabxml_VERSION_MAJOR @Libkolabxml_VERSION_MAJOR@)
+set(Libkolabxml_VERSION_MINOR @Libkolabxml_VERSION_MINOR@)
+set(Libkolabxml_VERSION_PATCH @Libkolabxml_VERSION_PATCH@)
+set(Libkolabxml_VERSION ${Libkolabxml_VERSION_MAJOR}.${Libkolabxml_VERSION_MINOR}.${Libkolabxml_VERSION_PATCH} )
+
+# what is my include directory
+set(Libkolabxml_INSTALL_PREFIX "${rootDir}")
+set(Libkolabxml_INCLUDES "${rootDir}/@INCLUDE_INSTALL_DIR@")
+
+# import the exported targets
+include(${myDir}/LibkolabxmlTargets.cmake)
+
+# set the expected library variable
+set(Libkolabxml_LIBRARIES kolab )
diff --git a/cmake/modules/LibkolabxmlConfigVersion.cmake.in b/cmake/modules/LibkolabxmlConfigVersion.cmake.in
new file mode 100644
index 0000000..af78034
--- /dev/null
+++ b/cmake/modules/LibkolabxmlConfigVersion.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 @Libkolabxml_VERSION_MAJOR@.@Libkolabxml_VERSION_MINOR@.@Libkolabxml_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}" )