You might consider scripting Code::Blocks from CMake in the future. Not now, but keep the idea in the back of your head as an idea.
A while back, support for running scripts passed via the command line was added. This was done for the ReactOS build system, which is creating Code::Blocks project files from scratch using a complicated script and binutils.
Since this involves a lot of pain for the one particular person who has to maintain it, a better solution was sought by calling Code::Blocks with a script file telling it what to do, and letting the IDE do the actual work natively.
Unluckily, it doesn't quite work as I would like it to at the present time, since file/path handling in Code::Blocks is a nightmare. If you create a project programmatically, the resulting paths are all different than if you create the project from within the IDE, which kind of makes it all a bit pointless, as the resulting project is a mess
![Sad :(](https://forums.codeblocks.org/Smileys/default/sad.gif)
But one day, we will hopefully use an unambiguous, unified system to handle paths and files, and when all the different components stop doing their own thing, it should work.
Once it works reliably though, you will be able to tell Code::Blocks to make a project with the files you want, add the options you want, etc. without ever having to worry what the project file looks like, or that we might change it some day, you can't get it wrong.