[llvm-branch-commits] [clang-doc][cmake] Copy assets to build directory (PR #95185)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jun 11 18:11:25 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tools-extra

Author: Paul Kirth (ilovepi)

<details>
<summary>Changes</summary>

While we copy the asset files, like index.js, into the
correct location in the install step, tests do not have
access to those resources in the build directory.

This patch copies the contents of the clang-doc/assets
directory into the build folder, so that they can be
used in testing.


---
Full diff: https://github.com/llvm/llvm-project/pull/95185.diff


1 Files Affected:

- (modified) clang-tools-extra/clang-doc/tool/CMakeLists.txt (+8) 


``````````diff
diff --git a/clang-tools-extra/clang-doc/tool/CMakeLists.txt b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
index fb8317b272932..c2425747562b9 100644
--- a/clang-tools-extra/clang-doc/tool/CMakeLists.txt
+++ b/clang-tools-extra/clang-doc/tool/CMakeLists.txt
@@ -25,3 +25,11 @@ install(FILES ../assets/clang-doc-default-stylesheet.css
 install(FILES ../assets/index.js
   DESTINATION "${CMAKE_INSTALL_DATADIR}/clang"
   COMPONENT clang-doc)
+
+add_custom_target(copy-clang-doc-assets
+  COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different "${CMAKE_CURRENT_SOURCE_DIR}/../assets" "${CMAKE_BINARY_DIR}/share/clang"
+  DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/../assets"
+  COMMENT "Copying Clang-Doc Assets"
+  )
+set_target_properties(copy-clang-doc-assets PROPERTIES FOLDER "Clang-Doc/Assets")
+add_dependencies(clang-doc copy-clang-doc-assets)

``````````

</details>


https://github.com/llvm/llvm-project/pull/95185


More information about the llvm-branch-commits mailing list