This resolves an irritating issue in the code editor where SDL2-specific functions could't be found. Not entirely sure about the SDL include file logic for other operating systems than Linux so the #ifdef directives may need to be updated further at a later date.
Also a general cleanup of CMakeLists.txt and many small code changes to satisfy Clang that complained quite a lot and actually wouldn't compile the binary at all at first.