Dune include C headers from project's root

#1

I have a following project tree:

.
include/
   common.h
lib/
   library.c
ocaml_stubs/
   foo.ml
   stubs.c
   dune

How to add include to stubs.c's compilation flags?

#2

Is this example of any help?

https://dune.readthedocs.io/en/latest/quick-start.html#defining-a-library-with-c-stubs

Best regards

#3

It seems that I could either refer to subdirectories or to the global directories, and not to the project root. Or could I? Is there something like this (c_flags (-I{%project-root}/blah/include))?

#4

I don’t know. You may try (with project_root or workspace_root, see https://dune.readthedocs.io/en/latest/dune-files.html#id4)|.|

Best regards

#5

One way to help checking this is using “-verbose” (ocaml*) program option.

-verbose Print calls to external commands

Best regards