Jbuilder executable depends on .cmx files

I have a rule for generating several cmx files using a custom OCaml compiler. I am unsure how to tell Jbuilder that these are dependencies. They are meant to be linked in via the -I flag, however this references the directory. Any and all help is appreciated.

I’ve found a hack that at least fixes the problem, even though it’s inelegant.

By adding a preprocess step, which takes an action, I can reference these files as necessary.

Please let me know if there is a better way to do this.

   (action (progn (run true ${path:proto/genesis/tezos_embedded_protocol_genesis.cmx})
                  (run true ${path:proto/alpha/tezos_embedded_protocol_alpha.cmx})
                  (run true ${path:proto/demo/tezos_embedded_protocol_demo.cmx}))))

It’s also not documented that an executable stanza can accept a preprocess sexpression.