'codegen' target when generating only headers

I wonder if the following behavior is a bug or was intended. When a custom target/command pattern is used to generate code (say some cpp files (with or without some header files)), the new codegen feature works correctly, and is a really wonderful addition to invoke the codegen first just before static checkers can step in.

However, when the custom target/command is generating headers only, which will become part of a header only library (aka INTERFACE) (and explicitly specified via the fileset mechanism), it falls down, and the headers are not generated.
I hope this is a bug so it can be corrected. Or is there something I should pay attention to, and as such I might be making a mistake ?

Any thoughts on this ?

Can you please provide a project which demonstrates the issue?

will do, hopefully tomorrow

CodeGen.tar.gz (1.7 KB)

Sample project added (CodeGen.tar.gz), little stupid project to reproduce.

2 types of code generation: both start from a file containing a numeric value

  • 1 will generate a header only library out of it, having this value as a named (inline) constant (GenHdr → will use the ‘Values’)
  • 1 will generate a regular library out of it, header exporting the constant, cpp file having its definition (GenLib → will use ValueLibs)
    GenHdr.sh and Genlib.sh are the ‘generators’
    GenHdr.cmake and GenLib.cmake are cmake eco system (custom command and custom target)
    User is an executable target that uses both

The directories Values and ValueLibs contain the 'source txt files containing the constant numeric values),
each with their own CMakeLists.txt which invoke the creation of the custom commands/targets

invoke cmake as:
1)cmake -DCMAKE_BUILD_TYPE=Release -B ./build
2)a)cmake --build ./build

==> all gets generated and build

if instead of 2) a) we do
2)b cmake --build ./build --target codegen
==> only the full library variants are generated, not the header only ones