Clean up CMake library specification

The X11 libraries don't need to be specified when doing dynamic linking. Also properly specifies `-pthreads` option, which fixes compilation on Linux clang for me.