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 99)
|
---|
46 | set(ariba_VERSION ${ariba_VERSION_MAJOR}.${ariba_VERSION_MINOR}.${ariba_VERSION_PATCH})
|
---|
47 |
|
---|
48 | message(STATUS "Configuring ariba version ${ariba_VERSION}")
|
---|
49 |
|
---|
50 | list(APPEND CMAKE_MODULE_PATH "${ariba_SOURCE_DIR}/CMakeModules")
|
---|
51 |
|
---|
52 |
|
---|
53 | # Add build type: Profiling
|
---|
54 | SET( CMAKE_CXX_FLAGS_PROFILING "-O2 -g -pg" CACHE STRING
|
---|
55 | "Flags used by the C++ compiler during profiling builds."
|
---|
56 | FORCE )
|
---|
57 | SET( CMAKE_C_FLAGS_PROFILING "-O2 -g -pg" CACHE STRING
|
---|
58 | "Flags used by the C compiler during profiling builds."
|
---|
59 | FORCE )
|
---|
60 | SET( CMAKE_EXE_LINKER_FLAGS_PROFILING
|
---|
61 | "" CACHE STRING
|
---|
62 | "Flags used for linking binaries during profiling builds."
|
---|
63 | FORCE )
|
---|
64 | SET( CMAKE_SHARED_LINKER_FLAGS_PROFILING
|
---|
65 | "" CACHE STRING
|
---|
66 | "Flags used by the shared libraries linker during profiling builds."
|
---|
67 | FORCE )
|
---|
68 | MARK_AS_ADVANCED(
|
---|
69 | CMAKE_CXX_FLAGS_PROFILING
|
---|
70 | CMAKE_C_FLAGS_PROFILING
|
---|
71 | CMAKE_EXE_LINKER_FLAGS_PROFILING
|
---|
72 | CMAKE_SHARED_LINKER_FLAGS_PROFILING )
|
---|
73 |
|
---|
74 | # set default build type
|
---|
75 | IF(NOT CMAKE_BUILD_TYPE)
|
---|
76 | SET(CMAKE_BUILD_TYPE Release
|
---|
77 | CACHE STRING "Choose the type of build : None Debug Release RelWithDebInfo MinSizeRel Profiling."
|
---|
78 | FORCE)
|
---|
79 | ENDIF(NOT CMAKE_BUILD_TYPE)
|
---|
80 | message(STATUS "Current build type is: ${CMAKE_BUILD_TYPE}")
|
---|
81 |
|
---|
82 | ## Provide some choices for CMAKE_BUILD_TYPE
|
---|
83 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
|
---|
84 | "" Release Debug RelWithDebInfo MinSizeRel Profiling)
|
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 | # Explicitly add BUILD_SHARED_LIBS to the user interface and default to on
|
---|
89 | option(BUILD_SHARED_LIBS "Whether to build libraries shared or static" ON)
|
---|
90 | mark_as_advanced(BUILD_SHARED_LIBS)
|
---|
91 |
|
---|
92 |
|
---|
93 |
|
---|
94 | # Option to produce statically linked binaries
|
---|
95 | option(BUILD_STATIC_BINS
|
---|
96 | "Whether to link executables statically.
|
---|
97 | If selected overrrides BUILD_SHARED_LIBS.
|
---|
98 | This option has to be set BEFORE the initial creation of the CMake cache
|
---|
99 | (this is only possible by using the non-interactive command line interface
|
---|
100 | `cmake ../ -DBUILD_STATIC_BINS=ON`)
|
---|
101 | Otherwise the library paths will not be rediscovered."
|
---|
102 | OFF
|
---|
103 | )
|
---|
104 |
|
---|
105 | if(DEFINED BUILD_STATIC_BINS_PREVIOUS_VALUE AND
|
---|
106 | ((BUILD_STATIC_BINS_PREVIOUS_VALUE AND NOT BUILD_STATIC_BINS) OR
|
---|
107 | (NOT BUILD_STATIC_BINS_PREVIOUS_VALUE AND BUILD_STATIC_BINS)))
|
---|
108 | message(FATAL_ERROR
|
---|
109 | "You can't set BUILD_STATIC_BINS to a different value after the "
|
---|
110 | "CMake cache has been built because then the library paths will not "
|
---|
111 | "be rediscovered. "
|
---|
112 | "Setting this before cache creation is only possible by using the "
|
---|
113 | "non-interactive command line interface: "
|
---|
114 | "`cmake ../ -DBUILD_STATIC_BINS=ON`"
|
---|
115 | )
|
---|
116 | endif()
|
---|
117 | set(BUILD_STATIC_BINS_PREVIOUS_VALUE "${BUILD_STATIC_BINS}" CACHE INTERNAL
|
---|
118 | "Internal value to detect whether the BUILD_STATIC_BINS has been previously
|
---|
119 | set to a different value"
|
---|
120 | )
|
---|
121 |
|
---|
122 | if(BUILD_STATIC_BINS)
|
---|
123 | set(BUILD_SHARED_LIBS OFF)
|
---|
124 | set(Boost_USE_STATIC_LIBS ON)
|
---|
125 | set(Boost_USE_STATIC_RUNTIME ON)
|
---|
126 | # Give priority to .a files (or equivalent)
|
---|
127 | set(CMAKE_FIND_LIBRARY_SUFFIXES
|
---|
128 | ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
---|
129 | endif(BUILD_STATIC_BINS)
|
---|
130 | # End of option to produce statically linked binaries
|
---|
131 |
|
---|
132 |
|
---|
133 | add_subdirectory(source)
|
---|
134 | add_subdirectory(sample)
|
---|
135 | add_subdirectory(docu)
|
---|
136 |
|
---|
137 |
|
---|
138 | # enable unit testing (in general, see the "tests/" subdirectory for the actual tests)
|
---|
139 | enable_testing()
|
---|
140 |
|
---|
141 | ## Google Test Framework (Unit testing)
|
---|
142 | add_subdirectory(gtest-1.7.0)
|
---|
143 |
|
---|
144 | # Tests (for ariba code)
|
---|
145 | add_subdirectory(tests)
|
---|
146 |
|
---|
147 |
|
---|
148 | # Install package information
|
---|
149 | install(EXPORT ariba-targets
|
---|
150 | DESTINATION lib/ariba
|
---|
151 | COMPONENT Development
|
---|
152 | )
|
---|
153 |
|
---|
154 | configure_file(
|
---|
155 | pkg/ariba-config.cmake.in
|
---|
156 | pkg/ariba-config.cmake
|
---|
157 | @ONLY
|
---|
158 | )
|
---|
159 |
|
---|
160 | configure_file(
|
---|
161 | pkg/ariba-config-local.cmake.in
|
---|
162 | ariba-config.cmake
|
---|
163 | @ONLY
|
---|
164 | )
|
---|
165 |
|
---|
166 | configure_file(
|
---|
167 | pkg/ariba-config-version.cmake.in
|
---|
168 | ariba-config-version.cmake
|
---|
169 | @ONLY
|
---|
170 | )
|
---|
171 |
|
---|
172 | install(
|
---|
173 | FILES
|
---|
174 | "${ariba_BINARY_DIR}/pkg/ariba-config.cmake"
|
---|
175 | "${ariba_BINARY_DIR}/ariba-config-version.cmake"
|
---|
176 | DESTINATION lib/ariba
|
---|
177 | COMPONENT Development
|
---|
178 | )
|
---|
179 |
|
---|
180 |
|
---|
181 |
|
---|
182 | # Packaging
|
---|
183 | set(CPACK_PACKAGE_VERSION_MAJOR
|
---|
184 | "${ariba_VERSION_MAJOR}"
|
---|
185 | )
|
---|
186 | set(CPACK_PACKAGE_VERSION_MINOR
|
---|
187 | "${ariba_VERSION_MINOR}"
|
---|
188 | )
|
---|
189 | set(CPACK_PACKAGE_VERSION_PATCH
|
---|
190 | "${ariba_VERSION_PATCH}"
|
---|
191 | )
|
---|
192 |
|
---|
193 | set(CPACK_SYSTEM_NAME
|
---|
194 | "${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}"
|
---|
195 | )
|
---|
196 |
|
---|
197 | set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
---|
198 | "Ariba P2P library"
|
---|
199 | )
|
---|
200 | #TODO: set(CPACK_PACKAGE_DESCRIPTION_FILE)
|
---|
201 | #TODO: set(CPACK_RESOURCE_FILE_README)
|
---|
202 | #TODO: set(CPACK_RESOURCE_FILE_WELCOME)
|
---|
203 |
|
---|
204 | set(CPACK_PACKAGE_VENDOR
|
---|
205 | "Institute of Telematics, UniversitÀt Karlsruhe (TH)"
|
---|
206 | )
|
---|
207 |
|
---|
208 | set(CPACK_SOURCE_PACKAGE_FILE_NAME "ariba-${ariba_VERSION}")
|
---|
209 |
|
---|
210 | include(CPack)
|
---|