diff --git a/CMakeModules/BoostPython3.cmake b/CMakeModules/BoostPython3.cmake index d5387d469..e708defa4 100644 --- a/CMakeModules/BoostPython3.cmake +++ b/CMakeModules/BoostPython3.cmake @@ -40,15 +40,18 @@ macro( find_boost_python3 boost_version python_version found_var ) break() endif() endforeach() - # The following loop changes 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() + + if (NOT ${found_var}) + # The following loop changes 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() + endif() endmacro()