Find pthreads using CMake

Makes the build work again under Archlinux x86_64. Should also work on other platforms since it uses CMake modules to find the pthreads library.