1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 12:42:41 +00:00
conky/cmake/clang-format.cmake
2019-02-23 17:13:19 -05:00

28 lines
949 B
CMake

set(CLANG_FORMAT_CXX_FILE_EXTENSIONS
${CLANG_FORMAT_CXX_FILE_EXTENSIONS}
*.cpp
*.h
*.cxx
*.hxx
*.hpp
*.cc
*.hh
*.ipp)
foreach(PATTERN ${CLANG_FORMAT_CXX_FILE_EXTENSIONS})
list(APPEND CLANG_FORMAT_CXX_PATTERN ${CMAKE_SOURCE_DIR}/src/${PATTERN})
list(APPEND CLANG_FORMAT_CXX_PATTERN ${CMAKE_SOURCE_DIR}/tests/${PATTERN})
list(APPEND CLANG_FORMAT_CXX_PATTERN ${CMAKE_SOURCE_DIR}/lua/${PATTERN})
endforeach()
file(GLOB_RECURSE CLANG_FORMAT_SRCS ${CLANG_FORMAT_CXX_PATTERN})
add_custom_target(clang-format
COMMAND ${CLANG_FORMAT_BIN} -style=file -i
${CLANG_FORMAT_SRCS})
add_custom_target(check-clang-format
COMMAND ${CMAKE_SOURCE_DIR}/bin/run-clang-format.py
--color always
--clang-format-executable ${CLANG_FORMAT_BIN}
${CLANG_FORMAT_SRCS})