mirror of
https://github.com/tstack/lnav.git
synced 2024-09-11 13:05:51 +03:00
33 lines
814 B
CMake
33 lines
814 B
CMake
set(
|
|
FORMAT_PATTERNS
|
|
src/*.cc src/*.hh
|
|
test/*.cc test/*.hh
|
|
CACHE STRING
|
|
"; separated patterns relative to the project source dir to format"
|
|
)
|
|
|
|
set(FORMAT_COMMAND clang-format CACHE STRING "Formatter to use")
|
|
|
|
add_custom_target(
|
|
format-check
|
|
COMMAND "${CMAKE_COMMAND}"
|
|
-D "FORMAT_COMMAND=${FORMAT_COMMAND}"
|
|
-D "PATTERNS=${FORMAT_PATTERNS}"
|
|
-P "${PROJECT_SOURCE_DIR}/cmake/lint.cmake"
|
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
|
COMMENT "Linting the code"
|
|
VERBATIM
|
|
)
|
|
|
|
add_custom_target(
|
|
format-fix
|
|
COMMAND "${CMAKE_COMMAND}"
|
|
-D "FORMAT_COMMAND=${FORMAT_COMMAND}"
|
|
-D "PATTERNS=${FORMAT_PATTERNS}"
|
|
-D FIX=YES
|
|
-P "${PROJECT_SOURCE_DIR}/cmake/lint.cmake"
|
|
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
|
|
COMMENT "Fixing the code"
|
|
VERBATIM
|
|
)
|