Skip to content

Extract shared cmake modules into ros2_medkit_cmake ament package #294

@bburda

Description

@bburda

Summary

The Jenkins ROS buildfarm fails on ros2_medkit_serialization (and potentially other packages) because shared cmake modules (ROS2MedkitCompat, ROS2MedkitCcache, ROS2MedkitLinting) in the top-level cmake/ directory are referenced via relative paths (../../cmake). On the buildfarm, each package is built as an isolated Debian package from a tarball - the parent workspace structure doesn't exist, so the includes fail.

Errors:

CMake Error at CMakeLists.txt:10 (include):
  include could not find requested file: ROS2MedkitCompat

CMake Error at CMakeLists.txt:34 (medkit_find_yaml_cpp):
  Unknown CMake command "medkit_find_yaml_cpp".

Proposed solution

Create a new src/ros2_medkit_cmake/ ament package (standard ROS 2 pattern, like ament_cmake_core) that:

  1. Ships the three cmake modules via install(FILES ... DESTINATION share/ros2_medkit_cmake/cmake)
  2. Uses an ament *-extras.cmake hook to auto-add the install path to CMAKE_MODULE_PATH
  3. Installs .clang-tidy alongside the modules so ROS2MedkitLinting.cmake can find it

All 11 consuming packages migrate from list(APPEND CMAKE_MODULE_PATH ...) to find_package(ros2_medkit_cmake REQUIRED) with <buildtool_depend> in package.xml.

Checklist:

  • Create ros2_medkit_cmake package (CMakeLists.txt, package.xml, extras.cmake)
  • Move cmake modules from cmake/ to src/ros2_medkit_cmake/cmake/
  • Fix .clang-tidy path in ROS2MedkitLinting.cmake
  • Migrate all 11 consuming packages (CMakeLists.txt + package.xml)
  • Clean build + unit tests pass
  • Update selfpatch_demos Dockerfiles (separate repo)
  • Update CLAUDE.md references

Additional context

Jenkins buildfarm log: jenkins_buildfarm.txt (build of ros-jazzy-ros2-medkit-serialization-0.3.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions