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...?)
[This StackOverflow](http://stackoverflow.com/questions/23250863/difference-between-pthread-and-lpthread-while-compiling) question might explain it better than I do.

Basically, there are two parts of `-pthread`, a compiler and a linker part. The former implies the latter, while the latter is dangerous without the former.