cmake-work

Initial splitting up and cleanup of CMake code (looking for feedback for now; merging would be best held off until the other directories have the same treatment). I'll add comments inline as to where some things need attention yet.
I usually also split this further into public (installed) and private headers and group them separately as well, but that's up to you whether you want that or not.