file(GENERATE ...) and target_sources
I just realized that target_sources
complains (during generation phase) that it is unable to find some source file which I generated with the file(GENERATE ...)
command in that very same CMakeLists.txt
file just a few lines above.
Although it says that it cannot find the source files, I can find them on the filesystem (after the failed CMake-run).
This is probably due to the fact that the files get generated after all CMakeLists.txt
files are processed (as the help of file(GENERATE ...)
states.
However, I would have expected that file(GENERATE ...)
sets the GENERATED
property on that specific file.
It does not!
And even if I set it myself, target_sources
still complains.
Is that maybe because the generated source files' name contain a generator-expression?
Note: target_sources
complains about not finding the files with their concrete names. But even if I set the GENERATED
property on the concrete files names it does not help.
I have the feeling target_sources
is broken and does not honor the GENERATED
property.
BTW: I am using CMake 3.18.