Prefer -pthread to -lpthread for better compatibility when cross-compiling (#771)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 76e5fc5..a616009 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -251,6 +251,7 @@
 endif()
 cxx_feature_check(STEADY_CLOCK)
 # Ensure we have pthreads
+set(THREADS_PREFER_PTHREAD_FLAG ON)
 find_package(Threads REQUIRED)
 
 # Set up directories