Check CMAKE_USE_PTHREADS_INIT for pthread presence.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 31733bf..9c6beae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -96,7 +96,7 @@
 
 set(PROTOBUF_CFLAGS "${CMAKE_C_FLAGS} ${NO_FUZZING_FLAGS} -w")
 set(PROTOBUF_CXXFLAGS "${CMAKE_CXX_FLAGS} ${NO_FUZZING_FLAGS} -w")
-if(THREADS_HAVE_PTHREAD_ARG)
+if(CMAKE_USE_PTHREADS_INIT)
   set(PROTOBUF_CFLAGS "${PROTOBUF_CFLAGS} -pthread")
   set(PROTOBUF_CXXFLAGS "${PROTOBUF_CXXFLAGS} -pthread")
 endif()