|
| 1 | +# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +############################################################################### |
| 16 | +# CMake build rules for FastCDR # |
| 17 | +############################################################################### |
| 18 | +cmake_minimum_required(VERSION 3.20) |
| 19 | + |
| 20 | +############################################################################### |
| 21 | +# Project # |
| 22 | +############################################################################### |
| 23 | +project(fastcdr VERSION 2.2.6 LANGUAGES CXX) |
| 24 | + |
| 25 | +set(PROJECT_NAME_STYLED "FastCDR") |
| 26 | +set(PROJECT_NAME_LARGE "Fast CDR") |
| 27 | +string(TOUPPER "${PROJECT_NAME}" PROJECT_NAME_UPPER) |
| 28 | +set(${PROJECT_NAME}_DESCRIPTION_SUMMARY "C++ library for serialize using CDR serialization") |
| 29 | +set(${PROJECT_NAME}_DESCRIPTION "eProsima ${PROJECT_NAME_LARGE} library provides two serialization mechanisms. One is the standard CDR serialization mechanism, while the other is a faster implementation that modifies the standard.") |
| 30 | + |
| 31 | +message(STATUS "Configuring ${PROJECT_NAME_LARGE}") |
| 32 | +message(STATUS "Version: ${PROJECT_VERSION}") |
| 33 | + |
| 34 | + |
| 35 | +############################################################################### |
| 36 | +# Default shared libraries |
| 37 | +############################################################################### |
| 38 | +# Global flag to cause add_library() to create shared libraries if on. |
| 39 | +# If set to true, this will cause all libraries to be built shared |
| 40 | +# unless the library was explicitly added as a static library. |
| 41 | +option(BUILD_SHARED_LIBS "Create shared libraries by default" OFF) |
| 42 | + |
| 43 | +############################################################################### |
| 44 | +# Test system configuration |
| 45 | +############################################################################### |
| 46 | +include(${PROJECT_SOURCE_DIR}/cmake/common/check_configuration.cmake) |
| 47 | + |
| 48 | +set(FORCE_CXX "11" CACHE STRING "C++ standard fulfillment selection") |
| 49 | +check_stdcxx(${FORCE_CXX}) |
| 50 | + |
| 51 | +check_endianness() |
| 52 | +check_type_sizes() |
| 53 | + |
| 54 | +############################################################################### |
| 55 | +# Installation paths |
| 56 | +############################################################################### |
| 57 | +set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/fastcdr") |
| 58 | + |
| 59 | +set(BIN_INSTALL_DIR bin/ CACHE PATH "Installation directory for binaries") |
| 60 | +set(_include_dir "include/") |
| 61 | +if(APPEND_PROJECT_NAME_TO_INCLUDEDIR) |
| 62 | + string(APPEND _include_dir "${PROJECT_NAME}/") |
| 63 | +endif() |
| 64 | +set(INCLUDE_INSTALL_DIR "${_include_dir}" CACHE PATH "Installation directory for C++ headers") |
| 65 | +unset(_include_dir) |
| 66 | +set(LIB_INSTALL_DIR lib${LIB_SUFFIX}/ CACHE PATH "Installation directory for libraries") |
| 67 | +set(DATA_INSTALL_DIR share/ CACHE PATH "Installation directory for data") |
| 68 | +if(WIN32) |
| 69 | + set(DOC_DIR "doc") |
| 70 | +else() |
| 71 | + set(DOC_DIR "${DATA_INSTALL_DIR}/doc") |
| 72 | +endif() |
| 73 | +set(DOC_INSTALL_DIR ${DOC_DIR} CACHE PATH "Installation directory for documentation") |
| 74 | +set(LICENSE_INSTALL_DIR ${DATA_INSTALL_DIR}/${PROJECT_NAME} CACHE PATH "Installation directory for licenses") |
| 75 | + |
| 76 | +############################################################################### |
| 77 | +# Compile library. |
| 78 | +############################################################################### |
| 79 | +add_subdirectory(src/cpp) |
| 80 | + |
0 commit comments