summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-03-27 15:12:08 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-03-27 15:12:08 (GMT)
commite8451d6426f6cd10ef1d0235b3358aee5d9cff17 (patch)
tree816fb0b84d199b38afc7fff389ecad73c5a28c28
parent0301e36fcd033f24b73a779adcc3f3b265793d85 (diff)
parent693f8bf34df5aaf22ed30039eff181352ed6574a (diff)
downloadCMake-e8451d6426f6cd10ef1d0235b3358aee5d9cff17.zip
CMake-e8451d6426f6cd10ef1d0235b3358aee5d9cff17.tar.gz
CMake-e8451d6426f6cd10ef1d0235b3358aee5d9cff17.tar.bz2
Merge topic 'threads-cleanup'
693f8bf3 FindThreads: simplify checking for SunOS 858ce31f FindThreads: avoid useless checks if a thread library is already found fdf7bd27 FindThreads: replace MATCHES with STREQUAL
-rw-r--r--Modules/FindThreads.cmake33
1 files changed, 16 insertions, 17 deletions
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index ec671bf..7f84522 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_NAME 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()
@@ -96,7 +95,7 @@ else()
if(NOT CMAKE_HAVE_THREADS_LIBRARY)
# If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
- if("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG")
+ if("x${THREADS_HAVE_PTHREAD_ARG}" STREQUAL "x")
message(STATUS "Check if compiler accepts -pthread")
try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG
${CMAKE_BINARY_DIR}