-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlint.cmake
More file actions
29 lines (27 loc) · 877 Bytes
/
lint.cmake
File metadata and controls
29 lines (27 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
file(GLOB_RECURSE files_to_format
${CMAKE_CURRENT_LIST_DIR}/include/ic_macro_magic.h
${CMAKE_CURRENT_LIST_DIR}/include/ic_macro_magic/ic_macro_magic_internal.h
${CMAKE_CURRENT_LIST_DIR}/tests/test_*/*.c
)
if("${CMAKE_ARGV3}" STREQUAL "format")
message("Running clang-format in-place")
foreach(file ${files_to_format})
execute_process(
COMMAND clang-format "-i" "${file}"
RESULT_VARIABLE res
)
if(NOT ${res} STREQUAL "0")
message(FATAL_ERROR "clang-format error")
endif()
endforeach()
endif()
foreach(file ${files_to_format})
execute_process(
COMMAND clang-format "--dry-run" "--Werror" "${file}"
RESULT_VARIABLE res
)
if(NOT ${res} STREQUAL "0")
message(FATAL_ERROR "clang-format error")
endif()
endforeach()
message("clang-format passed")