summaryrefslogtreecommitdiffstats
path: root/cmake/ClangFormat.cmake
blob: b815822fafa02ee2bdc9d6fd52517f2b6f6c643e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# get all project files
file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.c *.h *.m *.java)

include(ClangDetectTool)
clang_detect_tool(CLANG_FORMAT clang-format "")

if (NOT CLANG_FORMAT)
	message(WARNING "clang-format not found in path! code format target not available.")
else()
	add_custom_target(
			clangformat
			COMMAND ${CLANG_FORMAT}
			-style=file
			-i
			${ALL_SOURCE_FILES}
			)
endif()