[CMakeModules/BoostPython3] Fixed Boost library search for Gentoo based distributions

This commit is contained in:
skullbocks 2015-06-08 18:41:13 +02:00
parent df579ae144
commit 55476ae6fc

View File

@ -8,10 +8,18 @@
# what FindBoost.cmake is looking for. It looks for a library named # what FindBoost.cmake is looking for. It looks for a library named
# "libboost_${component}.so". # "libboost_${component}.so".
# #
# find_boost_python3() tries to find the package with different component names. # On Gentoo instead, the >=dev-libs/boost-1.54 package provides boost library
# By default it tries "python3" and "python-py$suffix", where suffix is based on # with a name like:
# the `python_version` argument. One can supply a custom component name by # libboost_python-2.7.so
# setting the `CALAMARES_BOOST_PYTHON3_COMPONENT` variable at CMake time. # libboost_python-3.3.so
# libboost_python-3.4.so
# depending on what python's targets you selected during install
#
# find_boost_python3() tries to find the package with different component
# names. By default it tries "python3", "python-py$suffix" and
# "python-$dotsuffix", where suffix is based on the `python_version` argument.
# One can supply a custom component name by setting the
# `CALAMARES_BOOST_PYTHON3_COMPONENT` variable at CMake time.
set( CALAMARES_BOOST_PYTHON3_COMPONENT python3 CACHE STRING set( CALAMARES_BOOST_PYTHON3_COMPONENT python3 CACHE STRING
"Name of the Boost.Python component. If Boost.Python is installed as "Name of the Boost.Python component. If Boost.Python is installed as
@ -32,4 +40,15 @@ macro( find_boost_python3 boost_version python_version found_var )
break() break()
endif() endif()
endforeach() endforeach()
# The following loop chage the searched name for Gentoo based distributions
# turns "3.4.123abc" into "3.4"
string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\..*" "\\1.\\2" _fbp_python_short_version ${python_version} )
foreach( _fbp_name ${CALAMARES_BOOST_PYTHON3_COMPONENT} python-${_fbp_python_short_version} )
find_package( Boost ${boost_version} QUIET COMPONENTS ${_fbp_name} )
string( TOUPPER ${_fbp_name} _fbp_uc_name )
if( Boost_${_fbp_uc_name}_FOUND )
set( ${found_var} ON )
break()
endif()
endforeach()
endmacro() endmacro()