This repository has been archived by the owner on Mar 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·77 lines (66 loc) · 2.14 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.10)
project(network_systems)
include(functions.cmake)
# Options and constants
option(STATIC_ANALYSIS "Enable clang-tidy checks" ON)
option(UNIT_TEST "Enable unit tests" ON)
set(CLANG_VERSION "14")
# Configure the compiler
set(CMAKE_CXX_COMPILER "/usr/bin/clang++-${CLANG_VERSION}")
if(STATIC_ANALYSIS)
set(CMAKE_CXX_CLANG_TIDY "clang-tidy-${CLANG_VERSION}")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Configure build flags
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(coverage_flags "-fprofile-arcs -ftest-coverage -fprofile-instr-generate -fcoverage-mapping")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS_DEBUG}"
# ${coverage_flags} Needs to be implemented
)
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
# Enable all warnings as errors except nested-anon-types, as it allows us to declare an unnamed struct within an
# anonymous union, which is allowed in the C++ standard. This appears to be a warning specific to clang++ with
# -Wpedantic, and does not appear with g++ or MSVC
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -Wall -Wextra -Wpedantic -Werror -Wno-nested-anon-types -pthread")
message(WARNING "Building Network Systems with build type '${CMAKE_BUILD_TYPE}' "
"and flags: '${CMAKE_CXX_FLAGS}'")
# ROS dependencies
set(ROS_DEPS
rclcpp
std_msgs
custom_interfaces
)
find_package(ament_cmake REQUIRED)
foreach(dep IN LISTS ROS_DEPS)
find_package(${dep} REQUIRED)
endforeach()
# Boost
find_package(Boost 1.74.0 COMPONENTS REQUIRED
program_options
serialization
system
thread
)
# MongoDB
find_package(mongocxx REQUIRED)
find_package(bsoncxx REQUIRED)
# Protobuf
find_package(Protobuf REQUIRED)
set(PROTOBUF_LINK_LIBS
${Protobuf_LIBRARIES}
protofiles
)
# Googletest (installed by sailbot_workspace Docker config)
if(UNIT_TEST)
find_package(GTest CONFIG REQUIRED)
set(GTEST_LINK_LIBS gtest gtest_main)
endif()
# Add src directories
add_subdirectory(lib)
add_subdirectory(projects)
# Install launch files
install(DIRECTORY launch DESTINATION share/network_systems)
ament_package()