The CodeOwners.rst file needs to live in the same directory as the rest
of the documentation. This copies the file to the correct place when
making a Sphinx build but continues to leave the .rst file at the root
directory where it's easier for developers to find. This also ensures
that local doc builds using `make html` work as expected.
# directory before we run sphinx.
add_custom_target(copy-clang-rst-docs
COMMAND "${CMAKE_COMMAND}" -E copy_directory
- "${CMAKE_CURRENT_SOURCE_DIR}"
- "${CMAKE_CURRENT_BINARY_DIR}")
+ "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}"
+
+ COMMAND "${CMAKE_COMMAND}" -E copy_if_different
+ "${CMAKE_CURRENT_SOURCE_DIR}/../CodeOwners.rst"
+ "${CMAKE_CURRENT_BINARY_DIR}"
+ )
add_dependencies(docs-clang-html copy-clang-rst-docs)
add_custom_command(TARGET docs-clang-html POST_BUILD