--- boost_1_38_0/libs/CMakeLists.txt 2009-01-24 18:57:20.000000000 +0000 +++ boost_1_38_0.patched/libs/CMakeLists.txt 2009-04-01 17:44:35.000000000 +0100 @@ -35,6 +35,51 @@ set(CPACK_INSTALL_CMAKE_COMPONENTS_ALL) list(SORT BOOST_SUBPROJECT_DIRS) topological_sort(BOOST_SUBPROJECT_DIRS BOOST_ _DEPENDS) + +# Make a bunch of options like ENABLE_upcase(lib) in the cache. Check +# if they've been disabled and add the lib to the PRUNE_LIST if they +# have. Make a reverse dependancy table while we're at it. +set(PRUNE_LIST) +foreach (proj ${BOOST_SUBPROJECT_DIRS}) + string(TOUPPER ${proj} proj_caps) + set(option_var ENABLE_${proj_caps}) + option(${option_var} "Build the boost.${proj} library; if no then reverse deps are disabled." YES) + + set(dep_list_var "BOOST_${proj_caps}_DEPENDS") + foreach (dep ${${dep_list_var}}) + string(TOUPPER ${dep} dep_caps) + list(APPEND "BOOST_${dep_caps}_REVDEPENDS" ${proj}) + endforeach() + + if (NOT ${option_var}) + message(STATUS "Disabling ${proj} because ${option_var} is off.") + set(mark_${dep}_removed TRUE) + list(APPEND PRUNE_LIST ${proj}) + endif() +endforeach() + +# Loop a stack of things to remove. Take them from BOOST_SUBPROJECT_DIRS. +# mark_$proj_is our visited flag. +while(PRUNE_LIST) + list(GET PRUNE_LIST 0 proj) + set(mark_${proj}_removed TRUE) + list(REMOVE_AT PRUNE_LIST 0) + list(REMOVE_ITEM BOOST_SUBPROJECT_DIRS ${proj}) + + string(TOUPPER ${proj} proj_caps) + # message(STATUS "Disable lib ${proj}") + set(revdep_var "BOOST_${proj_caps}_REVDEPENDS") + foreach(dep ${${revdep_var}}) + # Don't recurse uselessly. + if (NOT mark_${dep}_removed) + message(STATUS "Disable ${dep} because it depends on ${proj}") + list(INSERT PRUNE_LIST 0 ${dep}) + endif() + endforeach() + + set(${revdep_var}) +endwhile() + add_subdirectories(" + " ${BOOST_SUBPROJECT_DIRS}) # Write out a GraphViz file containing inter-library dependencies.