[clang] f0b09df - [clang-format] Add cmake target clang-format-style-options

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 19:38:43 PST 2024


Author: Owen Pan
Date: 2024-12-05T19:38:34-08:00
New Revision: f0b09dfd4c84fe8ffbc726da39ee5255e1a22a2f

URL: https://github.com/llvm/llvm-project/commit/f0b09dfd4c84fe8ffbc726da39ee5255e1a22a2f
DIFF: https://github.com/llvm/llvm-project/commit/f0b09dfd4c84fe8ffbc726da39ee5255e1a22a2f.diff

LOG: [clang-format] Add cmake target clang-format-style-options

This new custom target is for running dump_format_style.py to update
ClangFormatStyleOptions.rst if any of its dependencies changes.

Added: 
    

Modified: 
    clang/lib/Format/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/lib/Format/CMakeLists.txt b/clang/lib/Format/CMakeLists.txt
index ff987cc608fb88..7bb1a44f546f13 100644
--- a/clang/lib/Format/CMakeLists.txt
+++ b/clang/lib/Format/CMakeLists.txt
@@ -53,3 +53,19 @@ foreach (file IN LISTS files)
 endforeach ()
 
 add_custom_target(clang-format-check-format DEPENDS ${check_format_depends})
+
+if(CLANG_INCLUDE_DOCS)
+  set(style_options_depends ${CMAKE_CURRENT_BINARY_DIR}/dummy_output)
+  set(docs_tools_dir ${CLANG_SOURCE_DIR}/docs/tools)
+  add_custom_command(OUTPUT ${style_options_depends}
+    COMMAND ${Python3_EXECUTABLE} dump_format_style.py &&
+            touch ${style_options_depends}
+    WORKING_DIRECTORY ${docs_tools_dir}
+    DEPENDS ${CLANG_SOURCE_DIR}/include/clang/Format/Format.h
+            ${CLANG_SOURCE_DIR}/include/clang/Tooling/Inclusions/IncludeStyle.h
+            ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.rst
+            ${docs_tools_dir}/plurals.txt
+            ${docs_tools_dir}/dump_format_style.py
+    )
+  add_custom_target(clang-format-style-options DEPENDS ${style_options_depends})
+endif()


        


More information about the cfe-commits mailing list