New CMake-based build system, and a start of writing out repetition & definition levels (although this doesn't work yet)