Skip to content

Add optional ROS2 dependency support via find_package - #18

Draft
bsprenger with Copilot wants to merge 3 commits into
masterfrom
copilot/add-ros2-dependency-cmake
Draft

Add optional ROS2 dependency support via find_package#18
bsprenger with Copilot wants to merge 3 commits into
masterfrom
copilot/add-ros2-dependency-cmake

Conversation

Copilot AI commented Jan 31, 2026

Copy link
Copy Markdown
Contributor

Request was to add ROS2 as a CMake dependency using FetchContent. ROS2's ament_cmake build system has complex interdependencies that prevent standalone fetching—find_package() is the standard integration method.

Changes

  • CMakeLists.txt: Added BUILD_ROS2_SUPPORT option (OFF by default), finds rclcpp and std_msgs when enabled
  • tests/CMakeLists.txt: Conditional ros2_dependency_tests target linked against ROS2 libraries
  • tests/test_ros2_dependency.cpp: Test fixture verifying rclcpp init, node creation, and std_msgs availability

Usage

source /opt/ros/humble/setup.bash
cmake -DBUILD_ROS2_SUPPORT=ON -DBUILD_TESTS=ON ..
cmake --build .
ctest

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)
  • gitlab.com
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin REDACTED (dns block)
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin REDACTED tail -20 rchives/libeigen3-dev_3.4.0-4buiamswarm/CMakeFiles/AMSwarm.dir/constraint.cpp.o p.ci /usr/bin/gdbus /REDACTED/work/AMSgit (dns block)
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin REDACTED /usr/bin/dpkg --fo�� ompilerABI.cpp.o -o cmTC_0be8d && : --force-confdef estamp --print-foreign-git (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 31, 2026 21:17
Co-authored-by: bsprenger <28354950+bsprenger@users.noreply.github.com>
…iable

Co-authored-by: bsprenger <28354950+bsprenger@users.noreply.github.com>
Copilot AI changed the title [WIP] Add ros2 as a dependency in CMake Add optional ROS2 dependency support via find_package Jan 31, 2026
Copilot AI requested a review from bsprenger January 31, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants