diff options
author | Christian Mollekopf <mollekopf@kolabsys.com> | 2012-04-21 15:12:07 (GMT) |
---|---|---|
committer | Christian Mollekopf <mollekopf@kolabsys.com> | 2012-04-21 15:12:07 (GMT) |
commit | 13f2f6138eb63401579279139e226dc3165162d4 (patch) | |
tree | 9cba6e061c3c078c66e53a8ae4610bd25e224bed | |
parent | afb5c81d35e007c25e566bb0b8b57cc95a6cf38d (diff) | |
download | libkolabxml-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.
-rw-r--r-- | CMakeLists.txt | 142 | ||||
-rw-r--r-- | cmake/modules/CMakeLists.txt | 5 | ||||
-rw-r--r-- | cmake/modules/FindKolabInternal.cmake | 58 | ||||
-rw-r--r-- | cmake/modules/FindLibkolabxmlDependencies.cmake | 41 | ||||
-rw-r--r-- | cmake/modules/LibkolabxmlConfig.cmake.in | 18 | ||||
-rw-r--r-- | cmake/modules/LibkolabxmlConfigVersion.cmake.in | 14 | ||||
-rw-r--r-- | libkolabxml-version.h.cmake | 4 | ||||
-rw-r--r-- | src/CMakeLists.txt | 27 | ||||
-rw-r--r-- | src/csharp/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/java/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/php/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/python/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 2 |
13 files changed, 153 insertions, 177 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 406a4d8..9222e64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,18 @@ -project(libkolabxml NONE) - +project(Libkolabxml NONE) cmake_minimum_required(VERSION 2.6) +option( BUILD_TESTS "Build the tests" TRUE ) +option( DIST_ONLY "Build dist targets only (does not require a compiler)" FALSE ) +option( PYTHON_BINDINGS "Build bindings for python" FALSE ) +option( PHP_BINDINGS "Build bindings for php" FALSE ) +option( CSHARP_BINDINGS "Build bindings for csharp" FALSE ) +option( JAVA_BINDINGS "Build bindings for java" FALSE ) + + +set(Libkolabxml_MODULE_DIR ${Libkolabxml_SOURCE_DIR}/cmake/modules) +set(CMAKE_MODULE_PATH ${Libkolabxml_MODULE_DIR}) + # only available from cmake-2.8.0 if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 7) cmake_policy(SET CMP0012 NEW) @@ -14,24 +24,23 @@ 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 (Libkolabxml_VERSION_MAJOR 0) +set (Libkolabxml_VERSION_MINOR 3) +set (Libkolabxml_VERSION_PATCH 0) +set (Libkolabxml_VERSION "${Libkolabxml_VERSION_MAJOR}.${Libkolabxml_VERSION_MINOR}.${Libkolabxml_VERSION_PATCH}" ) +set (Libkolabxml_VERSION_STRING ${CMAKE_PROJECT_NAME}-${Libkolabxml_VERSION}) set (KOLAB_FORMAT_VERSION "3.0dev1") - message("Building DIST targets (make dist, make snapshot)") #make dist requires a tag with ${ARCHIVE_NAME} (e.g. libkolabxml-0.2.0) -set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${KOLABXML_VERSION}) +set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${Libkolabxml_VERSION}) 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}) #snapshot of current development version -set(SNAPSHOTARCHIVE_NAME "${CMAKE_PROJECT_NAME}-${KOLABXML_VERSION}-HEAD") +set(SNAPSHOTARCHIVE_NAME "${CMAKE_PROJECT_NAME}-${Libkolabxml_VERSION}-HEAD") add_custom_target(snapshot COMMAND git archive --prefix=${SNAPSHOTARCHIVE_NAME}/ HEAD | bzip2 > ${CMAKE_BINARY_DIR}/${SNAPSHOTARCHIVE_NAME}.tar.bz2 @@ -47,72 +56,37 @@ endif() #C++ is required from here on enable_language(CXX) +# set up install directories. INCLUDE_INSTALL_DIR and LIB_INSTALL_DIR must not be absolute paths +set(LIB_INSTALL_DIR_SUFFIX "" CACHE STRING "The directories where to install libraries to") +set(LIB_INSTALL_DIR lib${LIB_INSTALL_DIR_SUFFIX} ) +set(CMAKECONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/Kolab ) -configure_file(libkolabxml-version.h.cmake "${CMAKE_BINARY_DIR}/libkolabxml-version.h" @ONLY) - +# Use a versioned install directory for the headers so multiple versions can be installed in parallel +set(INCLUDE_INSTALL_DIR include/kolab ) -set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") -include( cmake/modules/FindKolabInternal.cmake ) - -add_subdirectory(cmake/modules) +configure_file(libkolabxml-version.h.cmake "${CMAKE_BINARY_DIR}/libkolabxml-version.h" @ONLY) set(Boost_USE_MULTITHREADED ON) find_package(Boost REQUIRED COMPONENTS thread) if (Boost_FOUND) message("Found boost in ${Boost_INCLUDE_DIRS}") - include_directories(${Boost_INCLUDE_DIRS}) endif (Boost_FOUND) -if (${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.42) - find_library(UUID NAMES ossp-uuid) - if(UUID) - message("uuid found") - else (UUID) - message(FATAL_ERROR "uuid NOT found!") - endif(UUID) -endif() +find_package(LibkolabxmlDependencies REQUIRED) # Must be after findboost -find_package(Qt4) -find_program( XSDCXX xsdcxx /usr/bin/) -if(XSDCXX) - message("xsd code generator found") -else (XSDCXX) - message(FATAL_ERROR - "xsd code generator NOT found!") -endif(XSDCXX) - -find_library(XERCES_C NAMES xerces-c xerces-c_2) -if(XERCES_C) - message("xerces found") -else (XERCES_C) - message(FATAL_ERROR - "xerces NOT found!") -endif(XERCES_C) - -find_program(SWIG swig /usr/bin/) -if(SWIG) - set(SWIG_FOUND ON) - message("SWIG found") -endif(SWIG) - -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" ) +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" ) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) if (GCC_VERSION VERSION_GREATER 4.7 OR GCC_VERSION VERSION_EQUAL 4.7) - message(STATUS "Version >= 4.7") - # gcc 4.7 no longer performs unqualified lookups by default, see: http://gcc.gnu.org/gcc-4.7/porting_to.html. - # This workaround is added for xsd code, which fails otherwise to compile. -fpermissive turns the errors into warnings. - # It's only temporary, and should be removed once xsd is fixed. - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive" ) + message(STATUS "GCC Version >= 4.7, applying unqualified lookup workaround") + # gcc 4.7 no longer performs unqualified lookups by default, see: http://gcc.gnu.org/gcc-4.7/porting_to.html. + # This workaround is added for xsd code, which fails otherwise to compile. -fpermissive turns the errors into warnings. + # It's only temporary, and should be removed once xsd is fixed. + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive" ) endif() -# set( CMAKE_VERBOSE_MAKEFILE on ) - -set(CMAKE_BUILD_TYPE Debug) - -set(CMAKE_BUILD_DIR ${CMAKE_SOURCE_DIR}/build) -file(MAKE_DIRECTORY ${CMAKE_BUILD_DIR}/bindings) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bindings) set( SCHEMA_DIR ${CMAKE_SOURCE_DIR}/schemas ) @@ -129,13 +103,13 @@ set( SCHEMAS ) set( SCHEMA_SOURCEFILES - ${CMAKE_BUILD_DIR}/bindings/kolabformat.cxx - ${CMAKE_BUILD_DIR}/bindings/xCard.cxx - ${CMAKE_BUILD_DIR}/bindings/kolabformat-xcal.cxx - ${CMAKE_BUILD_DIR}/bindings/kolabformat-xcard.cxx - ${CMAKE_BUILD_DIR}/bindings/iCalendar-params.cxx - ${CMAKE_BUILD_DIR}/bindings/iCalendar-props.cxx - ${CMAKE_BUILD_DIR}/bindings/iCalendar-valtypes.cxx + ${CMAKE_BINARY_DIR}/bindings/kolabformat.cxx + ${CMAKE_BINARY_DIR}/bindings/xCard.cxx + ${CMAKE_BINARY_DIR}/bindings/kolabformat-xcal.cxx + ${CMAKE_BINARY_DIR}/bindings/kolabformat-xcard.cxx + ${CMAKE_BINARY_DIR}/bindings/iCalendar-params.cxx + ${CMAKE_BINARY_DIR}/bindings/iCalendar-props.cxx + ${CMAKE_BINARY_DIR}/bindings/iCalendar-valtypes.cxx # bindings/iCalendar-link-extension.cxx # bindings/iCalendar-bw-extensions.cxx # bindings/iCalendar-ms-extensions.cxx @@ -145,7 +119,7 @@ set( SCHEMA_SOURCEFILES # --generate-inline --extern-xml-schema xml-schema.xsd # --cxx-suffix .cpp --hxx-suffix .h add_custom_command(OUTPUT ${SCHEMA_SOURCEFILES} - COMMAND ${XSDCXX} cxx-tree --generate-polymorphic --generate-serialization --namespace-map http://kolab.org=KolabXSD --root-element icalendar --root-element vcards --root-element note --output-dir ${CMAKE_BUILD_DIR}/bindings ${SCHEMAS} + COMMAND ${XSDCXX} cxx-tree --generate-polymorphic --generate-serialization --namespace-map http://kolab.org=KolabXSD --root-element icalendar --root-element vcards --root-element note --output-dir ${CMAKE_BINARY_DIR}/bindings ${SCHEMAS} COMMENT "Generating XSD bindings" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} DEPENDS ${SCHEMAS} @@ -153,11 +127,10 @@ add_custom_command(OUTPUT ${SCHEMA_SOURCEFILES} ) # Compile Schemas -find_program(XSDBIN_FOUND xsdbin) if (XSDBIN_FOUND) add_custom_command(OUTPUT kolabformat-xcal-schema.cxx - COMMAND ${XSDBIN_FOUND} --verbose --array-name iCalendar_schema --output-dir ${CMAKE_BUILD_DIR} ${SCHEMAS} + COMMAND ${XSDBIN} --verbose --array-name iCalendar_schema --output-dir ${CMAKE_BINARY_DIR} ${SCHEMAS} COMMENT "Compiling Kolab XSD schema" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} DEPENDS ${SCHEMAS} @@ -168,7 +141,7 @@ else (XSDBIN_FOUND) target_link_libraries(xsdbin ${XERCES_C}) add_custom_command(OUTPUT kolabformat-xcal-schema.cxx - COMMAND ${CMAKE_BUILD_DIR}/xsdbin --verbose --array-name iCalendar_schema --output-dir ${CMAKE_BUILD_DIR} ${SCHEMAS} + COMMAND ${CMAKE_BINARY_DIR}/xsdbin --verbose --array-name iCalendar_schema --output-dir ${CMAKE_BINARY_DIR} ${SCHEMAS} COMMENT "Compiling Kolab XSD schema" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} DEPENDS ${SCHEMAS} xsdbin @@ -176,21 +149,34 @@ else (XSDBIN_FOUND) ) endif (XSDBIN_FOUND) -set( SCHEMA_SOURCEFILES ${SCHEMA_SOURCEFILES} ${CMAKE_BUILD_DIR}/kolabformat-xcal-schema.cxx) +set( SCHEMA_SOURCEFILES ${SCHEMA_SOURCEFILES} ${CMAKE_BINARY_DIR}/kolabformat-xcal-schema.cxx) # --------- SET_SOURCE_FILES_PROPERTIES(${SCHEMA_SOURCEFILES} PROPERTIES GENERATED 1) ADD_CUSTOM_TARGET(generate_bindings ALL DEPENDS ${SCHEMA_SOURCEFILES}) -include_directories( ./ ) -include_directories( compiled ) -include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) +include_directories( + ./ + compiled + ${CMAKE_CURRENT_BINARY_DIR} + ${Boost_INCLUDE_DIRS} +) + add_subdirectory(src) -if (QT4_FOUND) +if (BUILD_TESTS) add_subdirectory(tests) -else() - message("Qt libraries have not been found, not building tests") endif() + +install(EXPORT LibkolabxmlExport DESTINATION ${CMAKECONFIG_INSTALL_DIR} FILE LibkolabxmlTargets.cmake ) + +file(RELATIVE_PATH relInstallDir ${CMAKE_INSTALL_PREFIX}/${CMAKECONFIG_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX} ) + +configure_file(${Libkolabxml_MODULE_DIR}/LibkolabxmlConfig.cmake.in ${Libkolabxml_BINARY_DIR}/LibkolabxmlConfig.cmake @ONLY ) +configure_file(${Libkolabxml_MODULE_DIR}/LibkolabxmlConfigVersion.cmake.in ${Libkolabxml_BINARY_DIR}/LibkolabxmlConfigVersion.cmake @ONLY ) +# Install these two files into the same directory as the generated exports-file. +install(FILES ${Libkolabxml_BINARY_DIR}/LibkolabxmlConfig.cmake ${Libkolabxml_BINARY_DIR}/LibkolabxmlConfigVersion.cmake + DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) + 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}" ) diff --git a/libkolabxml-version.h.cmake b/libkolabxml-version.h.cmake index d91e377..007c5a2 100644 --- a/libkolabxml-version.h.cmake +++ b/libkolabxml-version.h.cmake @@ -19,8 +19,8 @@ #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_LIB_VERSION "@Libkolabxml_VERSION@" +#define KOLAB_LIB_VERSION_STRING "@Libkolabxml_VERSION_STRING@" #define KOLAB_FORMAT_VERSION "@KOLAB_FORMAT_VERSION@" #endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fe43652..4410575 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,5 @@ +#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 @@ -17,9 +18,13 @@ else() #then normal case set_target_properties(kolabxml PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wconversion -Wl,--no-undefined") endif() -set_target_properties(kolabxml PROPERTIES VERSION ${KOLABXML_VERSION} SOVERSION 0) +set_target_properties(kolabxml PROPERTIES VERSION ${Libkolabxml_VERSION} SOVERSION ${Libkolabxml_VERSION_MAJOR}) -install(TARGETS kolabxml ${KOLAB_INSTALL_DIRECTORIES}) +install(TARGETS kolabxml EXPORT LibkolabxmlExport + RUNTIME DESTINATION ${BIN_INSTALL_DIR} + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + ARCHIVE DESTINATION ${LIB_INSTALL_DIR} +) install( FILES kolabformat.h @@ -30,23 +35,7 @@ install( FILES kolabnote.h kolabcontainers.h global_definitions.h - 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) - -# use, i.e. don't skip the full RPATH for the build tree -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 "${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 "${KOLAB_LIB_INSTALL_DIR}" isSystemDir) -IF("${isSystemDir}" STREQUAL "-1") - SET(CMAKE_INSTALL_RPATH "${KOLAB_LIB_INSTALL_DIR}") -ENDIF("${isSystemDir}" STREQUAL "-1") + 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 .. diff --git a/src/csharp/CMakeLists.txt b/src/csharp/CMakeLists.txt index 9cf268f..0fa9c0d 100644 --- a/src/csharp/CMakeLists.txt +++ b/src/csharp/CMakeLists.txt @@ -50,11 +50,7 @@ SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_CSHARP_DLL_FILE} PROPERTIES GENERATED 1 SET_SOURCE_FILES_PROPERTIES(${KOLAB_SWIG_CSHARP_TEST_FILE} PROPERTIES GENERATED 1) ADD_CUSTOM_TARGET(generate_csharp_bindings ALL DEPENDS ${KOLAB_SWIG_CSHARP_DLL_FILE} ${KOLAB_SWIG_CSHARP_TEST_FILE}) -if (KOLAB_CSHARP_INSTALL_DIR) - set(CSHARP_INSTALL_DIR ${KOLAB_CSHARP_INSTALL_DIR}) -else (KOLAB_CSHARP_INSTALL_DIR) - set(CSHARP_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/csharpbindings) -endif (KOLAB_CSHARP_INSTALL_DIR) +set(CSHARP_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/csharpbindings" CACHE STRING "Install directory for csharp bindings.") #not sure about the LIBRARY here, but might work install(FILES ${KOLAB_SWIG_CSHARP_DLL_FILE} DESTINATION ${CSHARP_INSTALL_DIR}) diff --git a/src/java/CMakeLists.txt b/src/java/CMakeLists.txt index 1283bfc..0435748 100644 --- a/src/java/CMakeLists.txt +++ b/src/java/CMakeLists.txt @@ -14,3 +14,4 @@ ADD_CUSTOM_TARGET(generate_JAVA_bindings ALL DEPENDS ${KOLAB_SWIG_JAVA_SOURCE_FI # Compile JAVA Bindings +# set(JAVA_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/javabindings" CACHE STRING "Install directory for java bindings.") diff --git a/src/php/CMakeLists.txt b/src/php/CMakeLists.txt index 1e82e08..f21e8d2 100644 --- a/src/php/CMakeLists.txt +++ b/src/php/CMakeLists.txt @@ -31,11 +31,7 @@ if (PHP4_FOUND) configure_file(test.php ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) - if (KOLAB_PHP_INSTALL_DIR) - set(PHP_INSTALL_DIR ${KOLAB_PHP_INSTALL_DIR}) - else (KOLAB_PHP_INSTALL_DIR) - set(PHP_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/phpbindings) - endif (KOLAB_PHP_INSTALL_DIR) + set(PHP_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/phpbindings" CACHE STRING "Install directory for php bindings.") install(TARGETS phpbindings LIBRARY DESTINATION ${PHP_INSTALL_DIR}) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 0c74f36..68a012a 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -36,11 +36,7 @@ SET_TARGET_PROPERTIES(kolabformat PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}") target_link_libraries(kolabformat kolabxml ${PYTHON_LIBRARIES}) configure_file(test.py ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) -if (KOLAB_PYTHON_INSTALL_DIR) - set(PYTHON_INSTALL_DIR ${KOLAB_PYTHON_INSTALL_DIR}) -else (KOLAB_PYTHON_INSTALL_DIR) - set(PYTHON_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/pythonbindings) -endif (KOLAB_PYTHON_INSTALL_DIR) +set(PYTHON_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/pythonbindings" CACHE STRING "Install directory for python bindings.") install(TARGETS kolabformat LIBRARY DESTINATION ${PYTHON_INSTALL_DIR}) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ecaa0ae..c3ae38c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,3 +1,5 @@ +find_package(Qt4) + include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. ) include_directories(${CMAKE_CURRENT_BINARY_DIR}) |