| 1 | # [License]
|
---|
| 2 | # The Ariba-Underlay Copyright
|
---|
| 3 | #
|
---|
| 4 | # Copyright (c) 2008-2012, Institute of Telematics, UniversitÀt Karlsruhe (TH)
|
---|
| 5 | #
|
---|
| 6 | # Institute of Telematics
|
---|
| 7 | # UniversitÀt Karlsruhe (TH)
|
---|
| 8 | # Zirkel 2, 76128 Karlsruhe
|
---|
| 9 | # Germany
|
---|
| 10 | #
|
---|
| 11 | # Redistribution and use in source and binary forms, with or without
|
---|
| 12 | # modification, are permitted provided that the following conditions are
|
---|
| 13 | # met:
|
---|
| 14 | #
|
---|
| 15 | # 1. Redistributions of source code must retain the above copyright
|
---|
| 16 | # notice, this list of conditions and the following disclaimer.
|
---|
| 17 | # 2. Redistributions in binary form must reproduce the above copyright
|
---|
| 18 | # notice, this list of conditions and the following disclaimer in the
|
---|
| 19 | # documentation and/or other materials provided with the distribution.
|
---|
| 20 | #
|
---|
| 21 | # THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TELEMATICS ``AS IS'' AND
|
---|
| 22 | # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
| 23 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
---|
| 24 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OF TELEMATICS OR
|
---|
| 25 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
---|
| 26 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
---|
| 27 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
---|
| 28 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
---|
| 29 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
---|
| 30 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
---|
| 31 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 32 | #
|
---|
| 33 | # The views and conclusions contained in the software and documentation
|
---|
| 34 | # are those of the authors and should not be interpreted as representing
|
---|
| 35 | # official policies, either expressed or implied, of the Institute of
|
---|
| 36 | # Telematics.
|
---|
| 37 | # [License]
|
---|
| 38 |
|
---|
| 39 | cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
|
---|
| 40 | project(ariba CXX)
|
---|
| 41 |
|
---|
| 42 | # Version
|
---|
| 43 | set(ariba_VERSION_MAJOR 0)
|
---|
| 44 | set(ariba_VERSION_MINOR 8)
|
---|
| 45 | set(ariba_VERSION_PATCH 1)
|
---|
| 46 | set(ariba_VERSION ${ariba_VERSION_MAJOR}.${ariba_VERSION_MINOR}.${ariba_VERSION_PATCH})
|
---|
| 47 |
|
---|
| 48 | message(STATUS "Configuring ariba version ${ariba_VERSION}")
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 | list(APPEND CMAKE_MODULE_PATH "${ariba_SOURCE_DIR}/CMakeModules")
|
---|
| 52 |
|
---|
| 53 | # Provide some choices for CMAKE_BUILD_TYPE
|
---|
| 54 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
---|
| 55 | "" Release Debug RelWithDebInfo MinSizeRel)
|
---|
| 56 |
|
---|
| 57 | # Explicitly add BUILD_SHARED_LIBS to the user interface and default to on
|
---|
| 58 | option(BUILD_SHARED_LIBS "Whether to build libraries shared or static" ON)
|
---|
| 59 | mark_as_advanced(BUILD_SHARED_LIBS)
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | # Option to produce statically linked binaries
|
---|
| 64 | option(BUILD_STATIC_BINS
|
---|
| 65 | "Whether to link executables statically.
|
---|
| 66 | If selected overrrides BUILD_SHARED_LIBS.
|
---|
| 67 | This option has to be set BEFORE the initial creation of the CMake cache
|
---|
| 68 | (this is only possible by using the non-interactive command line interface
|
---|
| 69 | `cmake ../ -DBUILD_STATIC_BINS=ON`)
|
---|
| 70 | Otherwise the library paths will not be rediscovered."
|
---|
| 71 | OFF
|
---|
| 72 | )
|
---|
| 73 |
|
---|
| 74 | if(DEFINED BUILD_STATIC_BINS_PREVIOUS_VALUE AND
|
---|
| 75 | ((BUILD_STATIC_BINS_PREVIOUS_VALUE AND NOT BUILD_STATIC_BINS) OR
|
---|
| 76 | (NOT BUILD_STATIC_BINS_PREVIOUS_VALUE AND BUILD_STATIC_BINS)))
|
---|
| 77 | message(FATAL_ERROR
|
---|
| 78 | "You can't set BUILD_STATIC_BINS to a different value after the "
|
---|
| 79 | "CMake cache has been built because then the library paths will not "
|
---|
| 80 | "be rediscovered. "
|
---|
| 81 | "Setting this before cache creation is only possible by using the "
|
---|
| 82 | "non-interactive command line interface: "
|
---|
| 83 | "`cmake ../ -DBUILD_STATIC_BINS=ON`"
|
---|
| 84 | )
|
---|
| 85 | endif()
|
---|
| 86 | set(BUILD_STATIC_BINS_PREVIOUS_VALUE "${BUILD_STATIC_BINS}" CACHE INTERNAL
|
---|
| 87 | "Internal value to detect whether the BUILD_STATIC_BINS has been previously
|
---|
| 88 | set to a different value"
|
---|
| 89 | )
|
---|
| 90 |
|
---|
| 91 | if(BUILD_STATIC_BINS)
|
---|
| 92 | set(BUILD_SHARED_LIBS OFF)
|
---|
| 93 | set(Boost_USE_STATIC_LIBS ON)
|
---|
| 94 | set(Boost_USE_STATIC_RUNTIME ON)
|
---|
| 95 | # Give priority to .a files (or equivalent)
|
---|
| 96 | set(CMAKE_FIND_LIBRARY_SUFFIXES
|
---|
| 97 | ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
---|
| 98 | endif(BUILD_STATIC_BINS)
|
---|
| 99 | # End of option to produce statically linked binaries
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 | add_subdirectory(source)
|
---|
| 103 | add_subdirectory(sample)
|
---|
| 104 | add_subdirectory(docu)
|
---|
| 105 |
|
---|
| 106 | # Install package information
|
---|
| 107 | install(EXPORT ariba-targets
|
---|
| 108 | DESTINATION lib/ariba
|
---|
| 109 | COMPONENT Development
|
---|
| 110 | )
|
---|
| 111 |
|
---|
| 112 | configure_file(
|
---|
| 113 | pkg/ariba-config.cmake.in
|
---|
| 114 | pkg/ariba-config.cmake
|
---|
| 115 | @ONLY
|
---|
| 116 | )
|
---|
| 117 |
|
---|
| 118 | configure_file(
|
---|
| 119 | pkg/ariba-config-local.cmake.in
|
---|
| 120 | ariba-config.cmake
|
---|
| 121 | @ONLY
|
---|
| 122 | )
|
---|
| 123 |
|
---|
| 124 | configure_file(
|
---|
| 125 | pkg/ariba-config-version.cmake.in
|
---|
| 126 | ariba-config-version.cmake
|
---|
| 127 | @ONLY
|
---|
| 128 | )
|
---|
| 129 |
|
---|
| 130 | install(
|
---|
| 131 | FILES
|
---|
| 132 | "${ariba_BINARY_DIR}/pkg/ariba-config.cmake"
|
---|
| 133 | "${ariba_BINARY_DIR}/ariba-config-version.cmake"
|
---|
| 134 | DESTINATION lib/ariba
|
---|
| 135 | COMPONENT Development
|
---|
| 136 | )
|
---|
| 137 |
|
---|
| 138 |
|
---|
| 139 |
|
---|
| 140 | # Packaging
|
---|
| 141 | set(CPACK_PACKAGE_VERSION_MAJOR
|
---|
| 142 | "${ariba_VERSION_MAJOR}"
|
---|
| 143 | )
|
---|
| 144 | set(CPACK_PACKAGE_VERSION_MINOR
|
---|
| 145 | "${ariba_VERSION_MINOR}"
|
---|
| 146 | )
|
---|
| 147 | set(CPACK_PACKAGE_VERSION_PATCH
|
---|
| 148 | "${ariba_VERSION_PATCH}"
|
---|
| 149 | )
|
---|
| 150 |
|
---|
| 151 | set(CPACK_SYSTEM_NAME
|
---|
| 152 | "${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}"
|
---|
| 153 | )
|
---|
| 154 |
|
---|
| 155 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
---|
| 156 | "Ariba P2P library"
|
---|
| 157 | )
|
---|
| 158 | #TODO: set(CPACK_PACKAGE_DESCRIPTION_FILE)
|
---|
| 159 | #TODO: set(CPACK_RESOURCE_FILE_README)
|
---|
| 160 | #TODO: set(CPACK_RESOURCE_FILE_WELCOME)
|
---|
| 161 |
|
---|
| 162 | set(CPACK_PACKAGE_VENDOR
|
---|
| 163 | "Institute of Telematics, UniversitÀt Karlsruhe (TH)"
|
---|
| 164 | )
|
---|
| 165 |
|
---|
| 166 | set(CPACK_SOURCE_PACKAGE_FILE_NAME "ariba-${ariba_VERSION}")
|
---|
| 167 |
|
---|
| 168 | include(CPack)
|
---|