don't autoformat generated source files
This commit is contained in:
parent
20f71fcf0d
commit
c4dcd7203d
|
@ -11,8 +11,14 @@ unset(_CLANG_FORMAT)
|
|||
function(add_autoformat_target target)
|
||||
get_target_property(source_dir ${target} SOURCE_DIR)
|
||||
get_target_property(sources ${target} SOURCES)
|
||||
foreach(source ${sources})
|
||||
get_property(generated SOURCE ${source} PROPERTY GENERATED)
|
||||
if(NOT ${generated})
|
||||
list(APPEND non_generated_sources ${source})
|
||||
endif()
|
||||
endforeach()
|
||||
add_custom_target(autoformat_${target}
|
||||
COMMAND clang-format -i -- ${sources}
|
||||
COMMAND clang-format -i -- ${non_generated_sources}
|
||||
WORKING_DIRECTORY ${source_dir}
|
||||
COMMENT "Autoformating sources of target ${target}"
|
||||
VERBATIM)
|
||||
|
|
Loading…
Reference in a new issue