Conversation
rclcpp, rclcpp_action, rclcpp_components and rclcpp_lifecycle all
already call ament_export_targets() to export modern CMake targets,
so downstream packages can (and should) link against those targets
instead of using the old-style CMake variables that
ament_export_include_directories() and ament_export_libraries() used
to populate. Delete both calls, and the now-stale 'Export old-style
CMake variables' comment above them, from all four packages'
CMakeLists.txt.
rclcpp_action and rclcpp_lifecycle each still read ${rclcpp_INCLUDE_DIRS}
in a BUILD_TESTING-only block, to give ament_cmake_cppcheck a hint about
include directories coming from outside the package:
set(ament_cmake_cppcheck_ADDITIONAL_INCLUDE_DIRS ${rclcpp_INCLUDE_DIRS})
Left both alone: this is a cppcheck lint hint, not a functional
build/link dependency, and out of this issue's stated scope (delete the
two calls from these four files). If ${rclcpp_INCLUDE_DIRS} does turn
out to go empty after this change, cppcheck may lose some macro-origin
hints during ament_lint_auto's cppcheck pass; it should not affect the
actual build.
Fixes ros2#3285
Signed-off-by: akshar <akshargothi70@gmail.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Snzt7njUYkxw4oxYJsENbQ
Signed-off-by: akshar <akshargothi70@gmail.com>
Collaborator
|
Please verify if the stack builds. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #3285
rclcpp,rclcpp_action,rclcpp_componentsandrclcpp_lifecycleall already callament_export_targets()to export modern CMake targets. Per the issue, that makes the old-styleament_export_include_directories()andament_export_libraries()calls in each package redundant, so this deletes both (and the now-stale "Export old-style CMake variables" comment above them) from all fourCMakeLists.txtfiles.Something I found while checking this (left untouched, flagging for review)
rclcpp_action/CMakeLists.txtandrclcpp_lifecycle/CMakeLists.txteach still read${rclcpp_INCLUDE_DIRS}inside aBUILD_TESTING-only block, to giveament_cmake_cppchecka hint about include directories coming from outside the package:That variable used to be populated by
rclcpp's ownament_export_include_directories()call, which this PR removes. I left both usages alone since (a) this is a cppcheck lint hint, not a functional build/link dependency, and (b) it's out of this issue's stated scope (delete the two calls from these four files). If${rclcpp_INCLUDE_DIRS}does go empty after this change, the practical effect should just be cppcheck losing some macro-origin hints during theament_lint_autocppcheck pass in CI, not a build break — but flagging it explicitly in case a maintainer wants it addressed as a follow-up (possibly by pointing atrclcpp_SOURCE_DIR/rclcpp_INCLUDE_DIRECTORIESfrom the modern target instead, or similar).Testing
No local ROS 2/colcon build environment was available, so I verified this differently:
ament_export_include_directories/ament_export_librariescall across all four files first, deleted exactly those + the associated stale comment, nothing else).CMakeLists.txtfiles for any reference to the old-style variables these calls populate (${rclcpp_INCLUDE_DIRS},${rclcpp_LIBRARIES}, and the equivalents for the other three packages) to catch any in-repo consumer that might break — found the two cppcheck-hint usages noted above, nothing else.cmakelinton all four modified files and compared the warning count against the unmodified upstream files: identical (12/0/20/16 respectively) — this change introduces no new lint warnings, all remaining warnings are pre-existing unrelated line-length flags.This PR was written with the help of Claude Code (Claude Sonnet 5), under my direction and review.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Snzt7njUYkxw4oxYJsENbQ