diff options
author | Roger Leigh <rleigh@codelibre.net> | 2015-12-01 21:59:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-12-02 14:40:17 (GMT) |
commit | 01c80acdbdadf3811bc0a6cab0c28469a4e9f5b7 (patch) | |
tree | d30e988a76058c39aa255af3ad5c73d5420210f1 /Modules | |
parent | 5183c6e5dd6ff2bbb5cce33a6f8b6b1d74dfe217 (diff) | |
download | CMake-01c80acdbdadf3811bc0a6cab0c28469a4e9f5b7.zip CMake-01c80acdbdadf3811bc0a6cab0c28469a4e9f5b7.tar.gz CMake-01c80acdbdadf3811bc0a6cab0c28469a4e9f5b7.tar.bz2 |
FindBoost: Automatically add missing component dependencies
The function _Boost_MISSING_DEPENDENCIES will look at the
user-supplied component list, check the dependency
information for each component using
_Boost_COMPONENT_DEPENDENCIES, and will add any missing
dependencies to the component list. This ensures that
all required components will be searched for.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindBoost.cmake | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 41b728d..19387ce 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -689,6 +689,45 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret) endfunction() # +# Determine if any missing dependencies require adding to the component list. +# +# Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component, +# plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be +# defined; FALSE if dependency information is unavailable). +# +# componentvar - the component list variable name +# +# +function(_Boost_MISSING_DEPENDENCIES componentvar) + # _boost_unprocessed_components - list of components requiring processing + # _boost_processed_components - components already processed (or currently being processed) + # _boost_new_components - new components discovered for future processing + # + list(APPEND _boost_unprocessed_components ${${componentvar}}) + + while(_boost_unprocessed_components) + list(APPEND _boost_processed_components ${_boost_unprocessed_components}) + foreach(component ${_boost_unprocessed_components}) + string(TOUPPER ${component} uppercomponent) + set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES) + set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) + set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) + foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES}) + list(FIND _boost_processed_components "${componentdep}" _boost_component_found) + list(FIND _boost_new_components "${componentdep}" _boost_component_new) + if (_boost_component_found EQUAL -1 AND _boost_component_new EQUAL -1) + list(APPEND _boost_new_components ${componentdep}) + endif() + endforeach() + endforeach() + set(_boost_unprocessed_components ${_boost_new_components}) + unset(_boost_new_components) + endwhile() + set(${componentvar} ${_boost_processed_components} PARENT_SCOPE) +endfunction() + +# # End functions/macros # #------------------------------------------------------------------------------- @@ -1200,6 +1239,10 @@ if(Boost_VERSION AND Boost_FIND_COMPONENTS) endif() endif() +# Additional components may be required via component dependencies. +# Add any missing components to the list. +_Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS) + # If the user changed any of our control inputs flush previous results. if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME) foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) |