There appears to be no way to set c_library_flags in an env stanza. I’m trying to add -L/usr/local/lib for linker execution in all subdirectories. Is there a good way to do this at the top level and avoid the need to patch dune files in subdirectories?’
Unfortunately, I don’t think this is currently possible, and I don’t know of any easy workaround.
Such flags should not usually be part of a project (especially if it is meant for distribution, other hosts can have libraries installed in other places), they belong to host configuration. You can use C compiler specific environment variables to control that, e.g.
LIBRARY_PATH for gcc.
I don’t think there’s a fundamental reason why we can’t add this to dune however. Seems like it would be quite convenient to add this. The bigger issue with this flag is that it’s not sufficient to specify a dependency on the files in this dir.