Index: tools/build/CMake/BoostCore.cmake =================================================================== --- tools/build/CMake/BoostCore.cmake (revision 47006) +++ tools/build/CMake/BoostCore.cmake (working copy) @@ -191,10 +191,41 @@ ${ULIBNAME}) if(THIS_PROJECT_HEADERS) + list(APPEND ${LIBNAME}-modularize-commands + COMMAND "${CMAKE_COMMAND}" -E remove_directory + "${Boost_SOURCE_DIR}/libs/${libname}/include" + COMMAND "${CMAKE_COMMAND}" -E make_directory + "${Boost_SOURCE_DIR}/libs/${libname}/include/boost" + ) + foreach(item ${THIS_PROJECT_HEADERS}) + if(EXISTS "${Boost_SOURCE_DIR}/boost/${item}") + if(IS_DIRECTORY "${Boost_SOURCE_DIR}/boost/${item}") + list(APPEND ${LIBNAME}-modularize-commands + COMMAND "${CMAKE_COMMAND}" -E copy_directory + "${Boost_SOURCE_DIR}/boost/${item}" + "${Boost_SOURCE_DIR}/libs/${libname}/include/boost/${item}" + COMMAND "${CMAKE_COMMAND}" -E remove_directory + "${Boost_SOURCE_DIR}/boost/${item}" + ) + else(IS_DIRECTORY "${Boost_SOURCE_DIR}/boost/${item}") + list(APPEND ${LIBNAME}-modularize-commands + COMMAND "${CMAKE_COMMAND}" -E copy + "${Boost_SOURCE_DIR}/boost/${item}" + "${Boost_SOURCE_DIR}/libs/${libname}/include/boost/${item}" + COMMAND "${CMAKE_COMMAND}" -E remove + "${Boost_SOURCE_DIR}/boost/${item}" + ) + endif(IS_DIRECTORY "${Boost_SOURCE_DIR}/boost/${item}") + else(EXISTS "${Boost_SOURCE_DIR}/boost/${item}") + MESSAGE(FATAL_ERROR + "Source file '${Boost_SOURCE_DIR}/boost/${item}' not available." + "Modularization might have moved it, please update your boost directory." + ) + endif(EXISTS "${Boost_SOURCE_DIR}/boost/${item}") + endforeach(item) + add_custom_target(${LIBNAME}-modularize - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/build/CMake/modularize.py - ${Boost_SOURCE_DIR}/boost ${THIS_PROJECT_HEADERS} ${Boost_SOURCE_DIR}/libs/${libname}/include/boost - WORKING_DIRECTORY ${Boost_SOURCE_DIR}/boost + ${${LIBNAME}-modularize-commands} COMMENT "Modularizing ${LIBNAME} headers to project-local dir from monolithic boost dir" ) add_dependencies(modularize ${LIBNAME}-modularize)