cmake: Commands for clang-[tidy|format]
This commit is contained in:
parent
68f72d69cc
commit
86d2186f89
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user