Fix Clang Sphinx docs build
authorAaron Ballman <aaron@aaronballman.com>
Tue, 6 Sep 2022 13:50:47 +0000 (09:50 -0400)
committerAaron Ballman <aaron@aaronballman.com>
Tue, 6 Sep 2022 13:52:22 +0000 (09:52 -0400)
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.

clang/docs/CMakeLists.txt

index 2d3ac5d..5329073 100644 (file)
@@ -114,8 +114,12 @@ if (LLVM_ENABLE_SPHINX)
       # 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