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

fix find boost-python for cv_bridge #390

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions cv_bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,24 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()

if(NOT ANDROID)
find_package(PythonLibs)
find_package(PythonLibs REQUIRED)
if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3)
find_package(Boost REQUIRED python)
else()
find_package(Boost QUIET)
if(Boost_VERSION LESS 106500)
find_package(Boost REQUIRED python)
else()
if(Boost_VERSION LESS 106700)
# This is a bit of a hack to suppress a warning
# No header defined for python3; skipping header check
# Which should only affect Boost versions < 1.67
# Resolution for newer versions:
# https://gitlab.kitware.com/cmake/cmake/issues/16391
if (Boost_VERSION LESS 106700)
set(_Boost_PYTHON3_HEADERS "boost/python.hpp")
endif()
find_package(Boost COMPONENTS python3 REQUIRED)
set(_Boost_PYTHON3_HEADERS "boost/python.hpp")
find_package(Boost REQUIRED python)
else()
string(REPLACE "." ";" VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
list(GET VERSION_LIST 0 PYTHONLIBS_VERSION_MAJOR)
list(GET VERSION_LIST 1 PYTHONLIBS_VERSION_MINOR)
find_package(Boost COMPONENTS python${PYTHONLIBS_VERSION_MAJOR}${PYTHONLIBS_VERSION_MINOR} REQUIRED)
endif()
endif()
else()
Expand Down