diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2014-03-25 22:47:49 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2014-03-25 22:47:49 (GMT) |
commit | 858ce31f4cd8d247a6dd7b8ae70ab9a38f71e7a2 (patch) | |
tree | d8d13d93d22ba872ef08d46b6f0890e307247a86 | |
parent | fdf7bd27a30fa53ae6f4239088444baba1d7f84e (diff) | |
download | CMake-858ce31f4cd8d247a6dd7b8ae70ab9a38f71e7a2.zip CMake-858ce31f4cd8d247a6dd7b8ae70ab9a38f71e7a2.tar.gz CMake-858ce31f4cd8d247a6dd7b8ae70ab9a38f71e7a2.tar.bz2 |
FindThreads: avoid useless checks if a thread library is already found
-rw-r--r-- | Modules/FindThreads.cmake | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index d7473a7..ff8aa29 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -63,32 +63,31 @@ else() set(CMAKE_THREAD_LIBS_INIT "") set(CMAKE_HAVE_THREADS_LIBRARY 1) set(Threads_FOUND TRUE) - endif() + else() - 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(CMAKE_HAVE_THREADS_LIBRARY 1) - set(Threads_FOUND TRUE) - endif() + else() - 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") + # 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(CMAKE_HAVE_THREADS_LIBRARY 1) set(Threads_FOUND TRUE) + + elseif(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() endif() endif() |