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

CMP0093 in findBoost changes how Boost_VERSION is reported #1902

Closed

Conversation

tspicer01
Copy link

This should fix the Boost version checks for the newer version of Boost.

Newer version (1.71+) report Boost_VERSION in x.y.z format, the older policy reported the Boost_VERSION_MACRO. Set the check to always use the Boost_VERSION_MACRO

See https://cmake.org/cmake/help/v3.15/policy/CMP0093.html?highlight=cmp0093

This should fix issue #1880

Tested using Boost version 1.71 and 1.67 on Ubuntu focal

@mikepurvis
Copy link
Member

mikepurvis commented Feb 28, 2020

This would also be fixable by using VERSION_LESS for the comparison, right? Wondering if that way might be more compatible.


Oh shoot no, that won't work either because you still need to compare against the other style of version number on the right hand side. Ugh, it looks like this came in as a consequence of CMP0093 in CMake 3.15:

https://cmake.org/cmake/help/v3.15/policy/CMP0093.html

If noetic-devel is supposed to support Debian Buster and Ubuntu Focal (per ros-infrastructure/rep#202), then we're dealing with CMake 3.13.4 and 3.16.3. TBH I think the easiest fix for this might be to just disable CMP0093.


A little bit of fun further discovery— CMP0093 only applies to the FindBoost shipped by CMake, which on Focal is in /usr/share/cmake-3.16/Modules/FindBoost.cmake. However, in Boost 1.71, Boost itself also ships its own module, in /usr/lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake.

The native Boost version is first in the search path, so setting CMP0093 in either direction does nothing— it doesn't exist in CMake 3.13, and by 3.16, Boost's own module aliases the place where it would have had an effect.

My suggestion would be to do something like this:

# Compatibility with Boost < 3.15.
if (NOT Boost_VERSION_STRING)
  set(Boost_VERSION_STRING "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
endif()

And then do comparisons against Boost_VERSION_STRING using VERSION_LESS and friends.

@dirk-thomas
Copy link
Member

Please see #1903 for an alternative approach since the conditional logic isn't necessary anymore.

@dirk-thomas
Copy link
Member

Closing in favor of #1903.

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