-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
100 lines (86 loc) · 3.13 KB
/
Copy pathCMakeLists.txt
File metadata and controls
100 lines (86 loc) · 3.13 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
cmake_minimum_required(VERSION 3.8)
project(zed_tutorial_video)
## Generate symbols for IDE indexer
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
################################################
# Check the ROS2 version
set(ROS2_FOUND FALSE)
if(DEFINED ENV{ROS_DISTRO})
set(FOUND_ROS2_DISTRO $ENV{ROS_DISTRO})
set(ROS2_FOUND TRUE)
#message("* Found ROS2 ${FOUND_ROS2_DISTRO}")
else()
message("* ROS2 distro variable not set. Trying to figure it out...")
set(ROS2_DISTROS "ardent;crystal;dashing;eloquent;foxy;galactic;humble;jazzy;rolling")
set(ROS2_FOUND FALSE)
foreach(distro ${ROS2_DISTROS})
if(NOT ROS2_FOUND)
find_path(RCLCPP_H rclcpp.hpp PATHS /opt/ros/${distro}/include/rclcpp)
if(RCLCPP_H)
message("* Found ROS2 ${distro}")
set(FOUND_ROS2_DISTRO ${distro})
set(ROS2_FOUND TRUE)
endif()
endif()
endforeach()
endif()
if(ROS2_FOUND)
if(${FOUND_ROS2_DISTRO} STREQUAL "foxy")
#message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.")
add_definitions(-DFOUND_FOXY)
elseif(${FOUND_ROS2_DISTRO} STREQUAL "humble")
#message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.")
add_definitions(-DFOUND_HUMBLE)
elseif(${FOUND_ROS2_DISTRO} STREQUAL "iron")
#message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.")
add_definitions(-DFOUND_IRON)
elseif(${FOUND_ROS2_DISTRO} STREQUAL "jazzy")
#message("* ROS2 ${FOUND_ROS2_DISTRO} is officially supported by this package.")
add_definitions(-DFOUND_JAZZY)
else()
message("*** WARNING *** Unsupported ROS2 ${FOUND_ROS2_DISTRO}. '${PROJECT_NAME}' may not work correctly.")
endif()
else()
message("*** WARNING *** ROS2 distro is unknown. This package could not work correctly.")
endif()
################################################
# if CMAKE_BUILD_TYPE is not specified, take 'Release' as default
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
# dependencies
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()
###############################################################################
# Add all files in subdirectories of the project in
# a dummy_target so qtcreator have access to all files
file(GLOB_RECURSE extra_files ${CMAKE_CURRENT_SOURCE_DIR}/*)
add_custom_target(${PROJECT_NAME}_files SOURCES ${extra_files})
###############################################################################
# includes
include_directories(
${rclcpp_INCLUDE_DIRS}
${sensor_msgs_INCLUDE_DIRS}
)
## Build
add_executable(zed_tutorial_video src/zed_video_sub_tutorial.cpp)
ament_target_dependencies(zed_tutorial_video
rclcpp
sensor_msgs
)
# Install executable
install(
TARGETS zed_tutorial_video
DESTINATION lib/${PROJECT_NAME}
)
ament_package()