add_custom_command fails when OUTPUT is generated into a subdirectory

  1. I think I am actually using 4 spaces as indentation, which seems to be the default in the VisualStudioCode IDE. Also I enabled autoformatting on save, so I guess I am good with the settings?! I do not know why your editor is showing you a messed up format…

  2. I probably didn’t do that, because I never solved the steps earlier. Eventually I would have fixed that.

  3. I absolutely do want the HEADER to be public. But yes, the implementation can be private. I do not understand why both of you think this is not needed?? How else would my-app be able to call the functions defined in that header or use the WORLD definition (#define WORLD "World")?

  4. That is essentially the solution I found a few minutes ago as well.

Find a full working example VERSION 4 in the attached project.

cmake-generate-sources.zip (11.4 KB)