cmake_minimum_required(VERSION 3.8)
project(example_interfaces_rclcpp)
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(example_ros2_interfaces REQUIRED)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# comment the line when a copyright and license is added to all source files
set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# comment the line when this package is in a git repo and when
# a copyright and license is added to all source files
set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
add_executable(example_interfaces_robot_01 src/example_interfaces_robot_01.cpp)
target_include_directories(example_interfaces_robot_01 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(example_interfaces_robot_01 PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
ament_target_dependencies(
example_interfaces_robot_01
"rclcpp"
"example_ros2_interfaces"
)
install(TARGETS example_interfaces_robot_01
DESTINATION lib/${PROJECT_NAME})
add_executable(example_interfaces_control_01 src/example_interfaces_control_01.cpp)
target_include_directories(example_interfaces_control_01 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(example_interfaces_control_01 PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
ament_target_dependencies(
example_interfaces_control_01
"rclcpp"
"example_ros2_interfaces"
)
install(TARGETS example_interfaces_control_01
DESTINATION lib/${PROJECT_NAME})
重要提示
鱼香小铺正式开业,最低499可入手一台能建图会导航的移动机器人,淘宝搜店:鱼香ROS 或点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
1597195629 发布的最新帖子
-
RE: ROS2入门篇第3章-自定义接口RCLCPP实战colcon build失败,找不到功能包
-
ROS2入门篇第3章-自定义接口RCLCPP实战colcon build失败,找不到功能包
一直按着鱼哥的教材走的,这是colcon build之后终端显示的错误,好像是找不到example_ros2_interfaces这个功能包,希望大佬帮解决一下
gaozhihao@gaozhihao-virtual-machine:~/Desktop/d2lros2/chapt3/chapt3_ws$ colcon build --packages-up-to example_interfaces_rclcpp Starting >>> example_interfaces_rclcpp --- stderr: example_interfaces_rclcpp CMake Error at CMakeLists.txt:11 (find_package): By not providing "Findexample_ros2_interfaces.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "example_ros2_interfaces", but CMake did not find one. Could not find a package configuration file provided by "example_ros2_interfaces" with any of the following names: example_ros2_interfacesConfig.cmake example_ros2_interfaces-config.cmake Add the installation prefix of "example_ros2_interfaces" to CMAKE_PREFIX_PATH or set "example_ros2_interfaces_DIR" to a directory containing one of the above files. If "example_ros2_interfaces" provides a separate development package or SDK, be sure it has been installed. gmake: *** [Makefile:308:cmake_check_build_system] 错误 1 --- Failed <<< example_interfaces_rclcpp [0.85s, exited with code 2] Summary: 0 packages finished [1.20s] 1 package failed: example_interfaces_rclcpp 1 package had stderr output: example_interfaces_rclcpp