forked from AhmedHumais/HEAR_ROS2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hear_ros2.cmake
56 lines (47 loc) · 1.3 KB
/
hear_ros2.cmake
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
set(HEAR_ROS2_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/include)
set(HEAR_ROS2_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src)
file(GLOB HEAR_ROS2_SRCs ${HEAR_ROS2_SOURCE_DIR}/*.cpp)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
find_package(ament_cmake REQUIRED)
find_package(std_msgs REQUIRED)
find_package(std_srvs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(tf2_ros REQUIRED)
if(TARGET tf2_geometry_msgs::tf2_geometry_msgs)
get_target_property(_include_dirs tf2_geometry_msgs::tf2_geometry_msgs INTERFACE_INCLUDE_DIRECTORIES)
else()
set(_include_dirs ${tf2_geometry_msgs_INCLUDE_DIRS})
endif()
find_file(TF2_CPP_HEADERS
NAMES tf2_geometry_msgs.hpp
PATHS ${_include_dirs}
NO_CACHE
PATH_SUFFIXES tf2_geometry_msgs
)
if(EXISTS ${TF2_CPP_HEADERS})
set(HEAR_ROS2_DEFs -DTF2_CPP_HEADERS)
endif()
set(HEAR_ROS2_AMENT_DEPS
geometry_msgs
rclcpp
tf2
tf2_ros
tf2_geometry_msgs
std_msgs
std_srvs
nav_msgs
)