add_custom_command fails when OUTPUT is generated into a subdirectory

I need the header files in my-app, that is why they are PUBLIC. I could add the implementation as PRIVATE, but it does not change anything.