Fix build error due to obsolete loadGraphicSurface() in SDL2 renderer

Also, add some error checking to the CMake file.