-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
97 lines (83 loc) · 3.28 KB
/
Copy pathCMakeLists.txt
File metadata and controls
97 lines (83 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
# CMake build rules for DDS Enabler Submodule
###############################################################################
cmake_minimum_required(VERSION 3.5)
add_definitions(-fPIC)
# Done this to set machine architecture and be able to call cmake_utils
enable_language(CXX)
###############################################################################
# Find package cmake_utils
###############################################################################
# Package cmake_utils is required to get every cmake macro needed
find_package(cmake_utils REQUIRED)
###############################################################################
# Project
###############################################################################
# Configure project by info set in project_settings.cmake
# - Load project_settings variables
# - Read version
# - Set installation paths
configure_project()
# Call explictly project
project(
${MODULE_NAME}
VERSION
${MODULE_VERSION}
DESCRIPTION
${MODULE_DESCRIPTION}
LANGUAGES
CXX
)
###############################################################################
# C++ Project
###############################################################################
# Configure CPP project for dependencies and required flags:
# - Set CMake Build Type
# - Set C++ version
# - Set shared libraries by default
# - Find external packages and thirdparties
# - Activate Code coverage if flag CODE_COVERAGE
# - Activate Address sanitizer build if flag ASAN_BUILD
# - Activate Thread sanitizer build if flag TSAN_BUILD
# - Configure log depending on LOG_INFO flag and CMake type
configure_project_cpp()
# Compile C++ library
compile_library(
"${PROJECT_SOURCE_DIR}/src/cpp" # Source directory
"${PROJECT_SOURCE_DIR}/include" # Include directory
)
###############################################################################
# Test
###############################################################################
# Compile tests if CMake options requires it
if(BUILD_TESTING)
set(BUILD_LIBRARY_TESTS ON)
endif()
compile_test_library(
"${PROJECT_SOURCE_DIR}/test/" # Test directory
)
###############################################################################
# Examples
###############################################################################
option(COMPILE_EXAMPLES "Build examples" OFF)
if(COMPILE_EXAMPLES)
add_subdirectory(examples)
endif()
###############################################################################
# Packaging
###############################################################################
# Install package
eprosima_packaging()