Add pthread to CMake check for semaphore support

Fixes issue #53

Some systems have sem_wait in librt, some in libpthread.
This add pthread to the CMake check for semaphore support.

Released under the MIT license.