1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00
conky/cmake/clang-format.cmake
2022-10-13 14:55:38 -05:00

31 lines
1.0 KiB
CMake

set(ClangFormat_CXX_FILE_EXTENSIONS
${ClangFormat_CXX_FILE_EXTENSIONS}
*.cpp
*.h
*.cxx
*.hxx
*.hpp
*.cc
*.hh
*.ipp)
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})
endforeach()
file(GLOB_RECURSE ClangFormat_SRCS ${ClangFormat_CXX_PATTERN})
# Remove catch2 from format sources
list(REMOVE_ITEM ClangFormat_SRCS ${CMAKE_SOURCE_DIR}/tests/catch2/catch.hpp)
add_custom_target(clang-format
COMMAND ${ClangFormat_BIN} -style=file -i
${ClangFormat_SRCS})
add_custom_target(check-clang-format
COMMAND ${CMAKE_SOURCE_DIR}/bin/run-clang-format.py
--color always
--clang-format-executable ${ClangFormat_BIN}
${ClangFormat_SRCS})