Skip to content

Commit 6b1c357

Browse files
committed
[clang-format] Add cmake target clang-format-help to update ClangFormat.rst
1 parent f4f6566 commit 6b1c357

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

clang/lib/Format/CMakeLists.txt

+21-8
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,39 @@ foreach(file IN LISTS files)
4848
COMMENT "Checking format of ${file}"
4949
)
5050
list(APPEND check_format_depends check_format_depend_${i})
51-
5251
math(EXPR i ${i}+1)
5352
endforeach()
54-
5553
add_custom_target(clang-format-check-format DEPENDS ${check_format_depends})
5654

57-
set(style_options_depends ${CMAKE_CURRENT_BINARY_DIR}/dummy_output)
5855
set(docs_tools_dir ${CLANG_SOURCE_DIR}/docs/tools)
56+
57+
set(format_style_depend ${CMAKE_CURRENT_BINARY_DIR}/format_style_depend)
58+
set(dump_style dump_format_style.py)
5959
set(style_options_rst ${CLANG_SOURCE_DIR}/docs/ClangFormatStyleOptions.rst)
60-
add_custom_command(OUTPUT ${style_options_depends}
61-
COMMAND ${Python3_EXECUTABLE} dump_format_style.py &&
62-
touch ${style_options_depends}
60+
add_custom_command(OUTPUT ${format_style_depend}
61+
COMMAND ${Python3_EXECUTABLE} ${dump_style} && touch ${format_style_depend}
6362
WORKING_DIRECTORY ${docs_tools_dir}
6463
VERBATIM
6564
COMMENT "Updating ${style_options_rst}"
6665
DEPENDS ${CLANG_SOURCE_DIR}/include/clang/Format/Format.h
6766
${CLANG_SOURCE_DIR}/include/clang/Tooling/Inclusions/IncludeStyle.h
6867
${style_options_rst}
6968
${docs_tools_dir}/plurals.txt
70-
${docs_tools_dir}/dump_format_style.py
69+
${docs_tools_dir}/${dump_style}
7170
)
71+
add_custom_target(clang-format-style DEPENDS ${format_style_depend})
7272

73-
add_custom_target(clang-format-style-options DEPENDS ${style_options_depends})
73+
set(format_help_depend ${CMAKE_CURRENT_BINARY_DIR}/format_help_depend)
74+
set(dump_help dump_format_help.py)
75+
set(clang_format_rst ${CLANG_SOURCE_DIR}/docs/ClangFormat.rst)
76+
add_custom_command(OUTPUT ${format_help_depend}
77+
COMMAND ${Python3_EXECUTABLE} ${dump_help} -d ${CMAKE_BINARY_DIR}/bin &&
78+
touch ${format_help_depend}
79+
WORKING_DIRECTORY ${docs_tools_dir}
80+
VERBATIM
81+
COMMENT "Updating ${clang_format_rst}"
82+
DEPENDS clang-format
83+
${clang_format_rst}
84+
${docs_tools_dir}/${dump_help}
85+
)
86+
add_custom_target(clang-format-help DEPENDS ${format_help_depend})

0 commit comments

Comments
 (0)