2021-01-24 00:22:47 +00:00
|
|
|
set(ClangFormat_CXX_FILE_EXTENSIONS
|
|
|
|
${ClangFormat_CXX_FILE_EXTENSIONS}
|
2019-02-23 19:40:34 +00:00
|
|
|
*.cpp
|
|
|
|
*.h
|
|
|
|
*.cxx
|
|
|
|
*.hxx
|
|
|
|
*.hpp
|
|
|
|
*.cc
|
|
|
|
*.hh
|
|
|
|
*.ipp)
|
|
|
|
|
2021-01-24 00:22:47 +00:00
|
|
|
foreach(PATTERN ${ClangFormat_CXX_FILE_EXTENSIONS})
|
|
|
|
list(APPEND ClangFormat_CXX_PATTERN ${CMAKE_SOURCE_DIR}/src/${PATTERN})
|
|
|
|
list(APPEND ClangFormat_CXX_PATTERN ${CMAKE_SOURCE_DIR}/tests/${PATTERN})
|
|
|
|
list(APPEND ClangFormat_CXX_PATTERN ${CMAKE_SOURCE_DIR}/lua/${PATTERN})
|
2019-02-23 19:40:34 +00:00
|
|
|
endforeach()
|
|
|
|
|
2021-01-24 00:22:47 +00:00
|
|
|
file(GLOB_RECURSE ClangFormat_SRCS ${ClangFormat_CXX_PATTERN})
|
2019-02-23 19:40:34 +00:00
|
|
|
|
|
|
|
add_custom_target(clang-format
|
2021-01-24 00:22:47 +00:00
|
|
|
COMMAND ${ClangFormat_BIN} -style=file -i
|
|
|
|
${ClangFormat_SRCS})
|
2019-02-23 19:40:34 +00:00
|
|
|
add_custom_target(check-clang-format
|
|
|
|
COMMAND ${CMAKE_SOURCE_DIR}/bin/run-clang-format.py
|
|
|
|
--color always
|
2021-01-24 00:22:47 +00:00
|
|
|
--clang-format-executable ${ClangFormat_BIN}
|
|
|
|
${ClangFormat_SRCS})
|