COMPILE_ONLY generator doesn't seem to create a dependency, should it?

We have a target that generates header files using a custom_target/custom_command pair in the “build/generated” directory, and then exports that directory with target_include_directories.

We recently switched one consumer of that target to use the COMPILE_ONLY generator when linking.

This creates an intermittent ordering issue in our build as the first target is no longer required to finish generating the header file before the consumer is built.

Is that expected?

No; I think a dependency should be present exactly because of generated headers (generated INTERFACE source files as well…). @robert.maynard I assume this is an oversight? We “just” need to add a direct dependency AFAIK.

Note that Ninja generators should be able to avoid depending on the link result of the target, but that may need further development.

That does look to be an oversight of COMPILE_ONLY. Please report an issue with a simple reproducer (if possible).

I think I mis-diagnosed what was going on here.

At least, I’m having a hard time reproducing it.

Sorry for the false alarm.