What does codegen have to do with Qt or CMake (I don't use either)? I was only thinking about generating .[ch]{,pp} files with very simple code in them, and compiling them.
I'd recommend checking out e.g. https://github.com/EpicGamesExt/raddebugger . They are doing a lot of codegen. The codebase is very self-sufficient. Currently works only on Windows x64 but coming to Linux soon it sounds like. (And the reason why not yet isn't codegen)
About embedding non-code resources, yes there are platform dependent solutions to file embedding that you'd have to support separately, but you can also ship an executable with separate asset files. With bigger assets that's probably the way to go. You can of course also opt to encode a file as C code (char data) but it's not very efficient.