Find the `.cmt` built by `dune @check` from the original file name

Hi,

I want, from the name of a source file, to get the corresponding .cmt built by dune @check. Is there any convenient way to do it? I tried to use dune rules without success and doing it by hand seems messy.

Thanks in advance for your time!

In upcoming dune 2.0 there is a feature to do this, see https://dune.readthedocs.io/en/stable/advanced-topics.html#variables-for-artifacts . However it only supports cmo, cmi, cmx, cma, cmxa right now. It would not be very hard to add cmt I think.