Skip to content

Latest commit

 

History

History
62 lines (43 loc) · 1.72 KB

File metadata and controls

62 lines (43 loc) · 1.72 KB

consumer_cmake

Minimal example that consumes ros-kilted from a pure CMake project — no colcon and no ament_cmake. Useful when you want to embed rclcpp into an application that already uses Conan for its dependency management.

← back to main README

What it does

A single executable consumer_node links against rclcpp::rclcpp, creates a node and emits one log line:

auto node = std::make_shared<rclcpp::Node>("conan_test_package_node");
RCLCPP_INFO(node->get_logger(), "Conan consumer_node: rclcpp linked and node started.");

See src/main.cpp.

How it is wired

  • conanfile.py declares a single requirement on ros-kilted/2026.06.17 and uses the CMakeDeps + CMakeToolchain generators with the standard cmake_layout().
  • CMakeLists.txt uses plain find_package(rclcpp REQUIRED). The ROS 2 CMake configs are provided by Conan, not by sourcing a setup.{bash,bat,ps1} script.

Prerequisites

  • A C++17 compiler.
  • CMake ≥ 3.22 (the profile tool-requires cmake/3.29.3).
  • A Conan remote that exposes ros-kilted — see the main README.

Build & run

From this directory:

conan install . --profile=../../profiles/ros --build=missing
conan build   . --profile=../../profiles/ros

Then run the binary produced by cmake_layout():

:: Windows
build\Release\consumer_node.exe
# macOS / Linux
./build/Release/consumer_node

Expected output (truncated):

[INFO] [...] [conan_test_package_node]: Conan consumer_node: rclcpp linked and node started.

The exact CI invocation lives in ci_test_example.py.