Skip to content

Fix cv_bridge CMake CMP0167 compatibility - #571

Closed
Quchaosheng wants to merge 1 commit into
ros-perception:rollingfrom
Quchaosheng:fix/cmake-cmp0167-boost
Closed

Quchaosheng wants to merge 1 commit into
ros-perception:rollingfrom
Quchaosheng:fix/cmake-cmp0167-boost

Conversation

@Quchaosheng

Copy link
Copy Markdown

Summary

Fix the CMake 3.30+ CMP0167 warning in cv_bridge while preserving compatibility with older ROS 2 distributions.

Background

CMake 3.30 removed the legacy FindBoost module and introduced policy CMP0167. The existing find_package(Boost ...) calls in cv_bridge/CMakeLists.txt therefore emit a developer warning, and newer environments may fail when the legacy module is unavailable.

Changes

  • Detect whether policy CMP0167 exists.
  • Set CMP0167 to NEW when supported, selecting Boost's config-package discovery.
  • Leave older CMake versions unchanged.
  • Keep the existing Boost/Python component selection logic intact.

Compatibility

The minimum required CMake version remains 3.14. On older CMake versions, the policy guard is skipped and the existing discovery behavior is preserved.

Validation

  • git diff --check passes.
  • The change is limited to CMake policy selection; no runtime code or public API is modified.

Closes #567

@mergify

mergify Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@Quchaosheng

Copy link
Copy Markdown
Author

@Mergifyio queue

@mergify

mergify Bot commented Sep 11, 2026

Copy link
Copy Markdown

queue

☑️ Command disallowed due to command restrictions in the Mergify configuration.

Details
  • sender-permission >= write

@Quchaosheng

Copy link
Copy Markdown
Author

@Mergifyio queue

@mergify

mergify Bot commented Sep 11, 2026

Copy link
Copy Markdown

queue

☑️ Command disallowed due to command restrictions in the Mergify configuration.

Details
  • sender-permission >= write

@Quchaosheng Quchaosheng reopened this Sep 11, 2026
@Quchaosheng

Copy link
Copy Markdown
Author

A gentle first ping on this one: 2/2 checks pass, the branch is unchanged since 09-11, and no human reviewer has looked at it yet. There is also a queue command on the PR that Mergify rejects due to its command restrictions, so that route cannot merge it. If the change needs a different approach, or if this is not wanted in rolling, say so and I will drop it.

@jmackay2

jmackay2 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

I ran into the same issue you solved here. It looks like there is also a prior PR that attempted to address and fix this issue: #568.

@Quchaosheng

Copy link
Copy Markdown
Author

Thanks for pointing at #568. I diffed the two and it sets CMP0167 to NEW in the same place mine does, so functionally they are the same change, mine just carries a comment explaining why.

Since #568 was first and is already approved, I am happy to be superseded by it. If you would rather take that one, say so and I will close this. No need to hold two PRs for the same fix, I just want the warning gone from rolling.

@Quchaosheng

Copy link
Copy Markdown
Author

Closing this as superseded by #568.

I diffed the two again: both set the same guarded if(POLICY CMP0167) cmake_policy(SET CMP0167 NEW) endif() before find_package(ament_cmake_ros), so the behavior is identical apart from the comment in mine. #568 is older and has an approving review, so it is the one that should carry #567. Keeping both open only splits the reviewer's attention.

Thanks @jmackay2 for the pointer. If #568 ends up not being merged and the warning still needs fixing, I am happy to reopen this or send a fresh version.

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.

cv_bridge CMakeLists triggers CMP0167 (FindBoost removed) on CMake 3.30+

2 participants