diff options
author | David Cole <david.cole@kitware.com> | 2011-09-21 21:29:39 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2011-09-21 21:29:39 (GMT) |
commit | 26e5b0ea82ed77d05b54adcd8d2ff029bff56280 (patch) | |
tree | 020c17f2bd863a32676c40f2e572bee8ee08182d | |
parent | ac623ce2fe3341ec451fc64e4be91320da3afcbe (diff) | |
parent | 98c49a4a258214306db86eb5d7a2383d8b0561d1 (diff) | |
download | CMake-26e5b0ea82ed77d05b54adcd8d2ff029bff56280.zip CMake-26e5b0ea82ed77d05b54adcd8d2ff029bff56280.tar.gz CMake-26e5b0ea82ed77d05b54adcd8d2ff029bff56280.tar.bz2 |
Merge topic 'revert-fix-for-11333'
98c49a4 Revert "FindThreads: Try pthreads with no special option first (#11333)"
-rw-r--r-- | Modules/FindThreads.cmake | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 21614fb..a6c2df8 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -23,7 +23,6 @@ INCLUDE (CheckIncludeFiles) INCLUDE (CheckLibraryExists) -INCLUDE (CheckSymbolExists) SET(Threads_FOUND FALSE) # Do we have sproc? @@ -45,41 +44,33 @@ ELSE() # SET(CMAKE_HAVE_THREADS_LIBRARY) IF(NOT THREADS_HAVE_PTHREAD_ARG) - # Check if pthread functions are in normal C library - CHECK_SYMBOL_EXISTS(pthread_create pthread.h CMAKE_HAVE_LIBC_CREATE) - IF(CMAKE_HAVE_LIBC_CREATE) - SET(CMAKE_THREAD_LIBS_INIT "") + + # Do we have -lpthreads + CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE) + IF(CMAKE_HAVE_PTHREADS_CREATE) + SET(CMAKE_THREAD_LIBS_INIT "-lpthreads") SET(CMAKE_HAVE_THREADS_LIBRARY 1) SET(Threads_FOUND TRUE) ENDIF() - IF(NOT CMAKE_HAVE_THREADS_LIBRARY) - # Do we have -lpthreads - CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE) - IF(CMAKE_HAVE_PTHREADS_CREATE) - SET(CMAKE_THREAD_LIBS_INIT "-lpthreads") - SET(CMAKE_HAVE_THREADS_LIBRARY 1) - SET(Threads_FOUND TRUE) - ENDIF() + # Ok, how about -lpthread + CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) + IF(CMAKE_HAVE_PTHREAD_CREATE) + SET(CMAKE_THREAD_LIBS_INIT "-lpthread") + SET(Threads_FOUND TRUE) + SET(CMAKE_HAVE_THREADS_LIBRARY 1) + ENDIF() - # Ok, how about -lpthread - CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE) - IF(CMAKE_HAVE_PTHREAD_CREATE) - SET(CMAKE_THREAD_LIBS_INIT "-lpthread") + IF(CMAKE_SYSTEM MATCHES "SunOS.*") + # On sun also check for -lthread + CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE) + IF(CMAKE_HAVE_THR_CREATE) + SET(CMAKE_THREAD_LIBS_INIT "-lthread") SET(CMAKE_HAVE_THREADS_LIBRARY 1) SET(Threads_FOUND TRUE) ENDIF() + ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*") - IF(CMAKE_SYSTEM MATCHES "SunOS.*") - # On sun also check for -lthread - CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE) - IF(CMAKE_HAVE_THR_CREATE) - SET(CMAKE_THREAD_LIBS_INIT "-lthread") - SET(CMAKE_HAVE_THREADS_LIBRARY 1) - SET(Threads_FOUND TRUE) - ENDIF() - ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*") - ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY) ENDIF(NOT THREADS_HAVE_PTHREAD_ARG) IF(NOT CMAKE_HAVE_THREADS_LIBRARY) @@ -120,7 +111,7 @@ ELSE() ENDIF(CMAKE_HAVE_PTHREAD_H) ENDIF() -IF(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_CREATE) +IF(CMAKE_THREAD_LIBS_INIT) SET(CMAKE_USE_PTHREADS_INIT 1) SET(Threads_FOUND TRUE) ENDIF() |