aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-10-23 10:36:32 -0700
committerChris Robinson <[email protected]>2009-10-23 10:36:32 -0700
commit7b24a12a6639d3d325ec819c6a9fb783b0f1f24e (patch)
tree9781bc9579c79d168e471e8919286bd047201ac7 /CMakeLists.txt
parent921e7ac3e9a6ef7cb17dec920f44169658d93c6f (diff)
Check for the -pthread switch instead of using _REENTRANT
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt9
1 files changed, 7 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 42da46d8..533daa30 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -213,18 +213,23 @@ IF(NOT HAVE_WINDOWS_H)
MESSAGE(FATAL_ERROR "No sleep function found!")
ENDIF()
+ CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD)
+ IF(HAVE_PTHREAD)
+ ADD_DEFINITIONS(-pthread)
+ SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread)
+ ENDIF()
+
# We need pthreads outside of Windows
CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD_H)
IF(NOT HAVE_PTHREAD_H)
MESSAGE(FATAL_ERROR "PThreads is required for non-Windows builds!")
ENDIF()
-
# Some systems need pthread_np.h to get recursive mutexes
CHECK_INCLUDE_FILES("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
# _GNU_SOURCE is needed on some systems for extra attributes, and
# _REENTRANT is needed for libc thread-safety
- ADD_DEFINITIONS(-D_GNU_SOURCE=1 -D_REENTRANT)
+ ADD_DEFINITIONS(-D_GNU_SOURCE=1)
CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD)
IF(HAVE_LIBPTHREAD)
SET(EXTRA_LIBS pthread ${EXTRA_LIBS})