how to add all .c files in one directory into sources.
this is not correct:
sources = [ "./fuzz_ioctl.c", "./Secodefuzz/mutators/*.c", "./Secodefuzz/common/*.c" ]
There is so many files in Secodefuzz/mutators and Secodefuzz/common. I don't want to write all the file-name.
GN does not natively support globs, and requires all source lists to be explicit.
It's not considered good GN style, but (for completeness) there is always
exec_script. You can useexec_scriptto run a script at configuration time, investigate the filesystem, and return a list back to GN:path/to/libfoo/BUILD.gn:
path/to/libfoo/get_c_files.py:
Note that
exec_scriptwill run every time you invoke GN (including sub-tools likedescandls), and can be a source of performance issues. Also, you can use the--timecommand-line option to profile your project.