generated from iscumd/isc-ros2-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
65 lines (54 loc) · 1.95 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
cmake_minimum_required(VERSION 3.8)
project(teleop_ack_joy)
include(FetchContent)
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif ()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(joy REQUIRED)
find_package(ackermann_msgs REQUIRED)
# Add source for node executable (link non-ros dependencies here)
add_executable(teleop_ack_joy src/TeleopAckJoyNode.cpp src/TeleopAckJoyNode_node.cpp)
target_include_directories(teleop_ack_joy PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(teleop_ack_joy PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
# Make ros deps a variable so they get linked to tests as well
set(dependencies
rclcpp
joy
sensor_msgs
ackermann_msgs
)
# Link ros dependencies
ament_target_dependencies(
teleop_ack_joy
${dependencies}
)
install(TARGETS teleop_ack_joy
DESTINATION lib/${PROJECT_NAME})
# Uncomment below to make launch files available if created
#install(
# DIRECTORY launch config
# DESTINATION share/${PROJECT_NAME}/
#)
if (BUILD_TESTING)
# Manually invoke clang format so it actually uses our file
find_package(ament_cmake_clang_format REQUIRED)
ament_clang_format(CONFIG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/.clang-format)
find_package(ament_cmake_gtest REQUIRED)
# Add unit tests
ament_add_gtest(${PROJECT_NAME}-test
tests/unit.cpp
# Remember to add node source files
src/TeleopAckJoyNode_node.cpp
)
ament_target_dependencies(${PROJECT_NAME}-test ${dependencies})
target_include_directories(${PROJECT_NAME}-test PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
endif ()
ament_package()