function(generate_target parent_name postfix generated_files gen_dst) add_custom_target(${parent_name}_${postfix} DEPENDS ${generated_files}) init_target(${parent_name}_${postfix} "(gen)") add_dependencies(${parent_name} ${parent_name}_${postfix}) target_sources(${parent_name} PRIVATE ${generated_files}) target_include_directories(${parent_name} PUBLIC ${gen_dst}) source_group("(gen)" FILES ${generated_files}) endfunction()