@@ -420,13 +420,13 @@ macro(CassUseLibuv)
420420 message (FATAL_ERROR "Unable to Locate libuv: libuv v1.0.0+ is required" )
421421 endif ()
422422
423- if (LIBUV_VERSION VERSION_LESS "1.0" )
423+ if (LIBUV_VERSION VERSION_LESS "1.0" )
424424 message (FATAL_ERROR "Libuv version ${LIBUV_VERSION} is not "
425425 " supported. Please updgrade to libuv version 1.0 or greater in order to "
426426 "utilize the driver." )
427427 endif ()
428428
429- if (LIBUV_VERSION VERSION_LESS "1.6" )
429+ if (LIBUV_VERSION VERSION_LESS "1.6" )
430430 message (WARNING "Libuv version ${LIBUV_VERSION} does not support custom "
431431 "memory allocators (version 1.6 or greater required)" )
432432 endif ()
@@ -436,10 +436,16 @@ macro(CassUseLibuv)
436436 set (CASS_LIBS ${CASS_LIBS} ${LIBUV_LIBRARIES} )
437437
438438 # libuv and gtests require thread library
439- set (THREADS_PREFER_PTHREAD_FLAG 1)
439+ set (CMAKE_THREAD_PREFER_PTHREAD 1)
440+ set (THREADS_PREFER_PTHREAD_FLAG 1)
440441 find_package (Threads REQUIRED )
441442 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_THREAD_LIBS_INIT} " )
442443 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_THREAD_LIBS_INIT} " )
444+ if (NOT WIN32 AND ${CMAKE_VERSION} VERSION_LESS "3.1.0" )
445+ # FindThreads in CMake versions < v3.1.0 do not have the THREADS_PREFER_PTHREAD_FLAG to prefer -pthread
446+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread" )
447+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread" )
448+ endif ()
443449endmacro ()
444450
445451#------------------------
0 commit comments