Build improvements

This fixes non-Xcode builds on OSX, a Clang warning, and cleans up the CMake files a bit. See commit comments for details (is this a bad way to do it...?)