# This script recursively copies all ReST documents from the source directory to
# the binary directory. CMAKE_CURRENT_SOURCE_DIR and SOURCES_DIR are substituted
# upon the cmake stage. The script is executed upon the make stage to ensure
# that the binary sources directory is always up to date.

file(GLOB SOURCES
  RELATIVE "@CMAKE_CURRENT_SOURCE_DIR@"
  "@CMAKE_CURRENT_SOURCE_DIR@/*.rst"
)
foreach(source ${SOURCES})
  configure_file(
    "@CMAKE_CURRENT_SOURCE_DIR@/${source}"
    "@SOURCES_DIR@/${source}"
    COPYONLY
    )
endforeach(source)
