CMake: Explicitly link against pthread

If a program creates threads, it should link against the pthread
library.