加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 2.39 KB
一键复制 编辑 原始数据 按行查看 历史
Vasile Holonec 提交于 2023-07-17 09:53 . Renamed files to 1650x name
cmake_minimum_required(VERSION 3.8)
project(imu_ros2)
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(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(builtin_interfaces REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_library(LIBIIO_LIBRARIES iio)
find_path(LIBIIO_INCLUDE_DIRS iio.h)
file(GLOB FILES_H ${CMAKE_SOURCE_DIR}/include/*.h
${CMAKE_SOURCE_DIR}/include/imu_ros2/*.h)
file(GLOB FILES_CPP ${CMAKE_SOURCE_DIR}/src/*.cpp)
add_executable(imu_ros2_node ${FILES_H} ${FILES_CPP})
target_include_directories(imu_ros2_node PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(imu_ros2_node PUBLIC cxx_std_17) # Require C++17
ament_target_dependencies(imu_ros2_node rclcpp geometry_msgs std_msgs sensor_msgs ament_cmake )
target_link_libraries(imu_ros2_node iio)
install(TARGETS imu_ros2_node
DESTINATION lib/${PROJECT_NAME})
rosidl_generate_interfaces(imu_ros2
"msg/ImuIdentificationData.msg"
"msg/VelAngTempData.msg"
"msg/Imu1650xDiagData.msg"
"msg/ImuFullMeasuredData.msg"
"msg/AccelGyroTempData.msg"
"msg/Imu1657xDiagData.msg"
DEPENDENCIES builtin_interfaces geometry_msgs
)
rosidl_target_interfaces(imu_ros2_node
${PROJECT_NAME} "rosidl_typesupport_cpp")
ament_export_dependencies(rosidl_default_runtime)
target_link_libraries(imu_ros2_node "${imu_ros2_node}")
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
find_package(ament_cmake_gtest 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()
#ament_add_gtest(iio_ros2_test_node test/utest_launch.test test/src/utest.cpp)
add_subdirectory(test)
endif()
install(FILES config/imu16505_config.yaml DESTINATION config)
install(FILES config/imu1657x_config.yaml DESTINATION config)
ament_package()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化