From fdf7bd27a30fa53ae6f4239088444baba1d7f84e Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 25 Mar 2014 22:46:11 +0100 Subject: FindThreads: replace MATCHES with STREQUAL --- Modules/FindThreads.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index ec671bf..d7473a7 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -96,7 +96,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} -- cgit v0.12 From 858ce31f4cd8d247a6dd7b8ae70ab9a38f71e7a2 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 25 Mar 2014 23:47:49 +0100 Subject: FindThreads: avoid useless checks if a thread library is already found --- Modules/FindThreads.cmake | 31 +++++++++++++++---------------- 1 file 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() -- cgit v0.12 From 693f8bf34df5aaf22ed30039eff181352ed6574a Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Tue, 25 Mar 2014 23:49:54 +0100 Subject: FindThreads: simplify checking for SunOS --- Modules/FindThreads.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index ff8aa29..7f84522 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -80,7 +80,7 @@ else() set(CMAKE_HAVE_THREADS_LIBRARY 1) set(Threads_FOUND TRUE) - elseif(CMAKE_SYSTEM MATCHES "SunOS.*") + 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) -- cgit v0.12