diff --git a/cmake/AddAutoformatTarget.cmake b/cmake/AddAutoformatTarget.cmake index baaffaa..07e739f 100644 --- a/cmake/AddAutoformatTarget.cmake +++ b/cmake/AddAutoformatTarget.cmake @@ -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)