Skip to content

Commit 124e7f6

Browse files
committed
fix find boost-python for cv_bridge
1 parent 05062b2 commit 124e7f6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

cv_bridge/CMakeLists.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,24 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1313
endif()
1414

1515
if(NOT ANDROID)
16-
find_package(PythonLibs)
16+
find_package(PythonLibs REQUIRED)
1717
if(PYTHONLIBS_VERSION_STRING VERSION_LESS 3)
1818
find_package(Boost REQUIRED python)
1919
else()
2020
find_package(Boost QUIET)
21-
if(Boost_VERSION LESS 106500)
22-
find_package(Boost REQUIRED python)
23-
else()
21+
if(Boost_VERSION LESS 106700)
2422
# This is a bit of a hack to suppress a warning
2523
# No header defined for python3; skipping header check
2624
# Which should only affect Boost versions < 1.67
2725
# Resolution for newer versions:
2826
# https://gitlab.kitware.com/cmake/cmake/issues/16391
29-
if (Boost_VERSION LESS 106700)
30-
set(_Boost_PYTHON3_HEADERS "boost/python.hpp")
31-
endif()
32-
find_package(Boost COMPONENTS python3 REQUIRED)
27+
set(_Boost_PYTHON3_HEADERS "boost/python.hpp")
28+
find_package(Boost REQUIRED python)
29+
else()
30+
string(REPLACE "." ";" VERSION_LIST ${PYTHONLIBS_VERSION_STRING})
31+
list(GET VERSION_LIST 0 PYTHONLIBS_VERSION_MAJOR)
32+
list(GET VERSION_LIST 1 PYTHONLIBS_VERSION_MINOR)
33+
find_package(Boost COMPONENTS python${PYTHONLIBS_VERSION_MAJOR}${PYTHONLIBS_VERSION_MINOR} REQUIRED)
3334
endif()
3435
endif()
3536
else()

0 commit comments

Comments
 (0)