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.
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.
conanfile.pydeclares a single requirement onros-kilted/2026.06.17and uses theCMakeDeps+CMakeToolchaingenerators with the standardcmake_layout().CMakeLists.txtuses plainfind_package(rclcpp REQUIRED). The ROS 2 CMake configs are provided by Conan, not by sourcing asetup.{bash,bat,ps1}script.
- 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.
From this directory:
conan install . --profile=../../profiles/ros --build=missing
conan build . --profile=../../profiles/rosThen run the binary produced by cmake_layout():
:: Windows
build\Release\consumer_node.exe# macOS / Linux
./build/Release/consumer_nodeExpected 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.