Skip to content

Commit f0b09df

Browse files
committed
[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.
1 parent 398f3b3 commit f0b09df

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

clang/lib/Format/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,19 @@ foreach (file IN LISTS files)
5353
endforeach ()
5454

5555
add_custom_target(clang-format-check-format DEPENDS ${check_format_depends})
56+
57+
if(CLANG_INCLUDE_DOCS)
58+
set(style_options_depends ${CMAKE_CURRENT_BINARY_DIR}/dummy_output)
59+
set(docs_tools_dir ${CLANG_SOURCE_DIR}/docs/tools)
60+
add_custom_command(OUTPUT ${style_options_depends}
61+
COMMAND ${Python3_EXECUTABLE} dump_format_style.py &&
62+
touch ${style_options_depends}
63+
WORKING_DIRECTORY ${docs_tools_dir}
64+
DEPENDS ${CLANG_SOURCE_DIR}/include/clang/Format/Format.h
65+
${CLANG_SOURCE_DIR}/include/clang/Tooling/Inclusions/IncludeStyle.h
66+
${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.rst
67+
${docs_tools_dir}/plurals.txt
68+
${docs_tools_dir}/dump_format_style.py
69+
)
70+
add_custom_target(clang-format-style-options DEPENDS ${style_options_depends})
71+
endif()

0 commit comments

Comments
 (0)