2018-01-10 10:54:24 +01:00
|
|
|
# get all project files
|
2024-11-27 20:31:31 +01:00
|
|
|
file(
|
|
|
|
|
GLOB_RECURSE
|
|
|
|
|
ALL_SOURCE_FILES
|
|
|
|
|
*.cpp
|
|
|
|
|
*.c
|
|
|
|
|
*.h
|
|
|
|
|
*.m
|
|
|
|
|
*.java
|
|
|
|
|
)
|
2018-01-10 10:54:24 +01:00
|
|
|
|
2024-01-24 15:08:33 +01:00
|
|
|
include(ClangDetectTool)
|
2024-01-25 09:59:39 +01:00
|
|
|
clang_detect_tool(CLANG_FORMAT clang-format "")
|
2018-01-10 10:54:24 +01:00
|
|
|
|
2024-11-27 20:31:31 +01:00
|
|
|
if(NOT CLANG_FORMAT)
|
|
|
|
|
message(WARNING "clang-format not found in path! code format target not available.")
|
2018-01-10 10:54:24 +01:00
|
|
|
else()
|
2024-11-27 20:31:31 +01:00
|
|
|
add_custom_target(clangformat COMMAND ${CLANG_FORMAT} -style=file -i ${ALL_SOURCE_FILES})
|
2018-01-10 10:54:24 +01:00
|
|
|
endif()
|