-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
118 lines (106 loc) · 4.24 KB
/
Copy pathCMakeLists.txt
File metadata and controls
118 lines (106 loc) · 4.24 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Copyright 2022 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 Pipe Submodule
###############################################################################
cmake_minimum_required(VERSION 3.5)
# 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()
file(
GLOB_RECURSE SOURCE_FILES
"${PROJECT_SOURCE_DIR}/src/cpp/*.c*"
"${PROJECT_SOURCE_DIR}/../thirdparty/nlohmann_json_schema_validator/*.cpp"
)
file(
GLOB_RECURSE INCLUDE_FILES
"${PROJECT_SOURCE_DIR}/include/*.hpp"
"${PROJECT_SOURCE_DIR}/include/testing/*.hpp"
"${PROJECT_SOURCE_DIR}/include/impl/*.ipp"
"${PROJECT_SOURCE_DIR}/../thirdparty/nlohmann_json/nlohmann/*.hpp"
"${PROJECT_SOURCE_DIR}/../thirdparty/nlohmann_json_schema_validator/*.hpp"
"${PROJECT_SOURCE_DIR}/../thirdparty/nlohmann_json_schema_validator/nlohmann/*.hpp"
)
#set(NLOHMANN_JSON_INCLUDE_DIR
# "${PROJECT_SOURCE_DIR}/../thirdparty/nlohmann_json/nlohmann")
#
#set(NLOHMANN_JSON_SCHEMA_INCLUDE_DIR
# "${PROJECT_SOURCE_DIR}/../thirdparty/nlohmann_json_schema_validator/nlohmann")
#
#install(
# DIRECTORY
# "${NLOHMANN_JSON_INCLUDE_DIR}"
# "${NLOHMANN_JSON_SCHEMA_INCLUDE_DIR}"
# DESTINATION
# ${INCLUDE_INSTALL_DIR}
# COMPONENT
# headers
# FILES_MATCHING
# PATTERN "*.h"
# PATTERN "*.hpp"
#)
# Compile C++ library
compile_library(
"${PROJECT_SOURCE_DIR}/src/cpp" # Source directory (not used because the list in ${SOURCE_FILES} is used instead)
"${PROJECT_SOURCE_DIR}/include" # Include directory (not used because the list in ${INCLUDE_FILES} is used instead)
"${SOURCE_FILES}" # List of source files to compile
"${INCLUDE_FILES}" # List of include files
)
###############################################################################
# Test
###############################################################################
# Compile tests if CMake options requires it
compile_test_library(
"${PROJECT_SOURCE_DIR}/test" # Test directory
)
###############################################################################
# Packaging
###############################################################################
# Install package
eprosima_packaging()