1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-25 13:55:47 -05:00

cmake: Commands for clang-[tidy|format]

This commit is contained in:
Michael Carlberg 2016-10-19 01:29:30 +02:00
parent 68f72d69cc
commit 86d2186f89

View file

@ -2,14 +2,15 @@
# Additional targets to perform clang-format/clang-tidy
#
file(GLOB_RECURSE SOURCE_FILES *.[chi]pp)
file(GLOB_RECURSE header_files ${PROJECT_SOURCE_DIR}/include/*.hpp)
file(GLOB_RECURSE source_files ${PROJECT_SOURCE_DIR}/src/*.cpp)
# Add clang-format target if executable is found
# --------------------------------------------------
find_program(CLANG_FORMAT "clang-format")
if(CLANG_FORMAT)
add_custom_target(clang-format COMMAND
${CLANG_FORMAT} -i -style=file ${SOURCE_FILES})
add_custom_target(clang-format COMMAND ${CLANG_FORMAT}
-i -style=file ${header_files} ${source_files})
endif()
# Add clang-tidy target if executable is found
@ -17,6 +18,5 @@ endif()
find_program(CLANG_TIDY "clang-tidy")
if(CLANG_TIDY)
add_custom_target(clang-tidy COMMAND ${CLANG_TIDY}
${SOURCE_FILES} -config='' -- -std=c++11
${INCLUDE_DIRECTORIES})
-p ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/src/main.cpp)
endif()