Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CMAKE_PREFIX_PATH to ament_cmake and cmake templates #606

Merged
merged 1 commit into from
Sep 28, 2020
Merged

Add CMAKE_PREFIX_PATH to ament_cmake and cmake templates #606

merged 1 commit into from
Sep 28, 2020

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented Sep 28, 2020

This CMake variable is already set for the catkin template, but is not currently set for the ament_cmake and plain cmake templates.

The CMAKE_INSTALL_PREFIX variable seems to be sufficient to allow CMake to find packages which are installed under that path, however when a package is present in a system location as well as under the target installation prefix, preference is given to the system package (given that it satisfies any version requirements specified).

Setting CMAKE_PREFIX_PATH should give preference to the packages under that path when a package is also available as a system package and both satisfy any version requirements.

Note that the RPM templates are already using CMAKE_PREFIX_PATH in this way.

This is motivated by some internal discussions at Open Robotics, which were initiated after observations of this (mis)behavior in google_benchmark_vendor and console_bridge_vendor (see ros2/console_bridge_vendor#19).

I'm not anticipating any breakage caused by this change (beyond the need to resolve patching conflicts in some packages), but since it touches a significant amount of packages, I'm planning to do a minor version bump when releasing Bloom.

This CMake variable is already set for the `catkin` template, but is not
currently set for the `ament_cmake` and plain `cmake` templates.

The `CMAKE_INSTALL_PREFIX` variable seems to be sufficient to allow
CMake to find packages which are installed under that path, however when
a package is present in a system location as well as under the target
installation prefix, preference is given to the system package (given
that it satisfies any version requirements specified).

Setting `CMAKE_PREFIX_PATH` should give preference to the packages under
that path when a package is also available as a system package and both
satisfy any version requirements.
Copy link
Member

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reference the previous discussion for future readers.

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me. I'll also point out that we are already doing this for catkin packages, as well as RPM packages, so some of the risk is reduced.

@cottsay cottsay merged commit 0e5085c into ros-infrastructure:master Sep 28, 2020
@cottsay cottsay deleted the cmake_prefix_path branch September 28, 2020 23:25
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.

3 participants