forked from blackcoffeerobotics/slim_bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
99 lines (83 loc) · 2.3 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
cmake_minimum_required(VERSION 3.5)
project(slim_bridge)
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra)
endif()
find_package(rmw REQUIRED)
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(yaml_cpp_vendor REQUIRED)
find_package(rmw_implementation_cmake REQUIRED)
find_package(std_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(tf2_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(visualization_msgs REQUIRED)
# find ROS 1 packages
set(cmake_extras_files cmake/find_ros1_package.cmake)
include(cmake/find_ros1_package.cmake)
find_package(PkgConfig)
if(NOT PKG_CONFIG_FOUND)
message(WARNING "Failed to find PkgConfig, skipping...")
# call ament_package() to avoid ament_tools treating this as a plain CMake pkg
ament_package()
return()
endif()
find_ros1_package(roscpp)
if(NOT ros1_roscpp_FOUND)
if(NOT ROS1_PACKAGES_UNAVAILABLE)
# Only warn if ROS1 packages were expected to be available
message(WARNING "Failed to find ROS 1 roscpp, skipping...")
endif()
# call ament_package() to avoid ament_tools treating this as a plain CMake pkg
ament_package(
CONFIG_EXTRAS ${cmake_extras_files}
)
return()
endif()
find_ros1_package(std_msgs REQUIRED)
find_ros1_package(tf2_msgs REQUIRED)
find_ros1_package(geometry_msgs REQUIRED)
find_ros1_package(sensor_msgs REQUIRED)
find_ros1_package(nav_msgs REQUIRED)
find_ros1_package(visualization_msgs REQUIRED)
set(SLIM_BRIDGE_DEPENDS
rclcpp
ros1_roscpp
std_msgs
ros1_std_msgs
yaml_cpp_vendor
sensor_msgs
ros1_sensor_msgs
tf2_msgs
ros1_tf2_msgs
nav_msgs
ros1_nav_msgs
visualization_msgs
ros1_visualization_msgs
)
ament_export_include_directories("include/${PROJECT_NAME}")
ament_package(
CONFIG_EXTRAS ${cmake_extras_files}
)
include_directories(include/)
add_executable(bridge src/bridge.cpp)
ament_target_dependencies(bridge ${SLIM_BRIDGE_DEPENDS})
target_include_directories(bridge PUBLIC include)
install(
DIRECTORY include/
DESTINATION include/${PROJECT_NAME}
)
install(
TARGETS bridge
DESTINATION lib/${PROJECT_NAME}
)
install(
DIRECTORY cmake launch config
DESTINATION share/${PROJECT_NAME}
)