[Cmake-commits] CMake branch, next, updated. v3.0.2-5692-g4585ef7

Rolf Eike Beer eike at sf-mail.de
Wed Oct 8 11:57:53 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  4585ef7db51d87f5082b30308bbc86c7ed8e387f (commit)
       via  b7e5c5a23ae8d429186873dd2095e2180f62f522 (commit)
       via  bcb0e3872b50bbbd669285fe9b6156bac42a2690 (commit)
      from  befff631d3658c2178f2e75add482f360ec73b5a (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=4585ef7db51d87f5082b30308bbc86c7ed8e387f
commit 4585ef7db51d87f5082b30308bbc86c7ed8e387f
Merge: befff63 b7e5c5a
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Wed Oct 8 11:57:52 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Oct 8 11:57:52 2014 -0400

    Merge topic 'FindThreads_overhaul' into next
    
    b7e5c5a2 FindThreads: introduce THREADS_PREFER_PTHREAD_FLAG (#14767)
    bcb0e387 FindThreads: introduce an imported target to link to


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b7e5c5a23ae8d429186873dd2095e2180f62f522
commit b7e5c5a23ae8d429186873dd2095e2180f62f522
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Mon Oct 6 21:43:45 2014 +0200
Commit:     Rolf Eike Beer <eike at sf-mail.de>
CommitDate: Wed Oct 8 17:57:34 2014 +0200

    FindThreads: introduce THREADS_PREFER_PTHREAD_FLAG (#14767)

diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index 108b56f..a0bc4d1 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -25,6 +25,17 @@
 # ::
 #
 #   CMAKE_THREAD_PREFER_PTHREAD
+#
+# If the use of the -pthread compiler and linker flag is prefered then the
+# caller can set
+#
+# ::
+#
+#   THREADS_PREFER_PTHREAD_FLAG
+#
+# Please note that the compiler flag can only be used with the imported
+# target. Use of both the imported target as well as this switch is highly
+# recommended for new code.
 
 #=============================================================================
 # Copyright 2002-2009 Kitware, Inc.
@@ -126,6 +137,13 @@ else()
         set(Threads_FOUND TRUE)
       else()
 
+        # Check for -pthread first if enabled. This is the recommended
+        # way, but not backwards compatible as one must also pass -pthread
+        # as compiler flag then.
+        if (THREADS_PREFER_PTHREAD_FLAG)
+           _check_pthreads_flag()
+        endif ()
+
         _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")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bcb0e3872b50bbbd669285fe9b6156bac42a2690
commit bcb0e3872b50bbbd669285fe9b6156bac42a2690
Author:     Timo Rothenpieler <btbn at btbn.de>
AuthorDate: Mon Oct 6 21:36:13 2014 +0200
Commit:     Rolf Eike Beer <eike at sf-mail.de>
CommitDate: Wed Oct 8 17:57:34 2014 +0200

    FindThreads: introduce an imported target to link to
    
    This not only holds the library, but can also hold compiler flags needed, e.g.
    the -pthread flag preferred by gcc on some platforms. There was no clean way
    to get that compiler flag from the module until now.

diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index aac9c0e..108b56f 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -14,6 +14,12 @@
 #   CMAKE_USE_PTHREADS_INIT    - are we using pthreads
 #   CMAKE_HP_PTHREADS_INIT     - are we using hp pthreads
 #
+# The following import target is created
+#
+# ::
+#
+#   Threads::Threads
+#
 # For systems with multiple thread libraries, caller can set
 #
 # ::
@@ -178,3 +184,15 @@ endif()
 set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND)
+
+if(THREADS_FOUND AND NOT TARGET Threads::Threads)
+  add_library(Threads::Threads INTERFACE IMPORTED)
+
+  if(THREADS_HAVE_PTHREAD_ARG)
+    set_property(TARGET Threads::Threads PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread")
+  endif()
+
+  if(CMAKE_THREAD_LIBS_INIT)
+    set_property(TARGET Threads::Threads PROPERTY INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
+  endif()
+endif()

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list