[Cmake-commits] CMake branch, next, updated. v3.0.2-5561-gcd31209

Rolf Eike Beer eike at sf-mail.de
Thu Oct 2 17:06:47 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  cd312091fba12663d90f7dc612837ce72882e205 (commit)
       via  e94a8925dc04a9fc0f15ea687a0f188ceb652f9e (commit)
      from  e04d423cbbe03519d4b81c78921649ac5e2e9bdf (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cd312091fba12663d90f7dc612837ce72882e205
commit cd312091fba12663d90f7dc612837ce72882e205
Merge: e04d423 e94a892
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Thu Oct 2 17:06:45 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Oct 2 17:06:45 2014 -0400

    Merge topic 'FindThreads-macro' into next
    
    e94a8925 FindThreads: use a macro for the repetitive thread library checks


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e94a8925dc04a9fc0f15ea687a0f188ceb652f9e
commit e94a8925dc04a9fc0f15ea687a0f188ceb652f9e
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Thu Oct 2 22:23:20 2014 +0200
Commit:     Rolf Eike Beer <eike at sf-mail.de>
CommitDate: Thu Oct 2 22:23:20 2014 +0200

    FindThreads: use a macro for the repetitive thread library checks

diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index 6050dcd..d51a1da 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -45,6 +45,17 @@ if(CMAKE_SYSTEM_NAME MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD)
   CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h"  CMAKE_HAVE_SPROC_H)
 endif()
 
+macro(check_threads_lib LIBNAME FUNCNAME VARNAME)
+  if(NOT CMAKE_HAVE_THREADS_LIBRARY)
+     CHECK_LIBRARY_EXISTS(${LIBNAME} ${FUNCNAME} "" ${VARNAME})
+     if(${VARNAME})
+       set(CMAKE_THREAD_LIBS_INIT "-l${LIBNAME}")
+       set(CMAKE_HAVE_THREADS_LIBRARY 1)
+       set(Threads_FOUND TRUE)
+     endif()
+  endif ()
+endmacro()
+
 if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD)
   # We have sproc
   set(CMAKE_USE_SPROC_INIT 1)
@@ -67,30 +78,11 @@ else()
         set(Threads_FOUND TRUE)
       else()
 
-        # 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)
-        else()
-
-          # 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")
+        check_threads_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE)
+        check_threads_lib(pthread  pthread_create CMAKE_HAVE_PTHREAD_CREATE)
+        if(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()
+            check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE)
         endif()
       endif()
     endif()

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindThreads.cmake |   38 +++++++++++++++-----------------------
 1 file changed, 15 insertions(+), 23 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list