Merge pull request #51 from flandr/pthread-cmake-build

Link libpthread when necessary in CMake builds