Skip to content

Improve Boost Python component detection for CMake-based Boost installs - #559

Open
idesign0 wants to merge 1 commit into
ros-perception:rollingfrom
idesign0:rolling
Open

Improve Boost Python component detection for CMake-based Boost installs#559
idesign0 wants to merge 1 commit into
ros-perception:rollingfrom
idesign0:rolling

Conversation

@idesign0

Copy link
Copy Markdown

This PR improves the CMake logic used to locate Boost.Python in cv_bridge.

Recent Boost versions (e.g. 1.89) built with CMake no longer generate
versioned CMake package config files for Python components such as:

boost_python311-config.cmake

Instead, the only available package config file is the generic component:

boost_python-config.cmake

This causes the current logic:

    find_package(Boost REQUIRED COMPONENTS python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
    set(boost_python_target "Boost::python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")

to fail even though the library file libboost_python311.* exists.

Cause

CMake-built Boost installs:

  • libboost_python<pyver>.*
  • a generic CMake target: Boost::python

But does not install:

  • Boost::python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}
  • boost_python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}-config.cmake

As a result, CMake cannot resolve the requested versioned component, and the
configuration step fails even though the underlying library file exists.

CMake Side FIx

Use versioned Boost.Python components when available, and automatically fall back to the generic python component when they are not.
This makes the CMake logic compatible with both CMake-built and Autotools-built Boost installations.

Signed-off-by: Dhruv Patel <dhruvpatel2991998@gmail.com>
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.

1 participant