Skip to content

Commit

Permalink
Add clang-format to cmake list
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolay Yushkevich <[email protected]>
  • Loading branch information
neewy committed Jan 23, 2018
1 parent 8b79fb1 commit f1a4402
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ include_directories(
include(FeatureSummary)
include(cmake/functions.cmake)
include(cmake/dependencies.cmake)
include(cmake/clang-cxx-dev-tools.cmake)

if(PACKAGE_TGZ OR PACKAGE_ZIP OR PACKAGE_RPM OR PACKAGE_DEB)
include(cmake/release.cmake)
Expand Down
17 changes: 17 additions & 0 deletions cmake/clang-cxx-dev-tools.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Additional targets to perform clang-format/clang-tidy
# Get all project files
file(GLOB_RECURSE
ALL_CXX_SOURCE_FILES
*.[chi]pp *.[chi]xx *.cc *.hh *.ii *.[CHI]
)

# Adding 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
${ALL_CXX_SOURCE_FILES}
)
endif()

0 comments on commit f1a4402

Please sign in to comment.