[Cmake-commits] CMake branch, next, updated. v3.0.2-5638-g9636477

Rolf Eike Beer eike at sf-mail.de
Tue Oct 7 12:16:17 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  9636477672916b7521e3c0b9d65c8fff07ce99b1 (commit)
       via  5838043e647f21053c9f544962fa116248d54ed9 (commit)
       via  decc7d1ef66c31b78f78b68b869396ecd2b2cbee (commit)
      from  174fa21256e0f958b45a50317e67898823aecf42 (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=9636477672916b7521e3c0b9d65c8fff07ce99b1
commit 9636477672916b7521e3c0b9d65c8fff07ce99b1
Merge: 174fa21 5838043
Author:     Rolf Eike Beer <eike at sf-mail.de>
AuthorDate: Tue Oct 7 12:16:16 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Oct 7 12:16:16 2014 -0400

    Merge topic 'FindThreads_overhaul' into next
    
    5838043e FindThreads: introduce THREADS_PREFER_PTHREAD_FLAG (#14767)
    decc7d1e FindThreads: introduce an imported target to link to


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5838043e647f21053c9f544962fa116248d54ed9
commit 5838043e647f21053c9f544962fa116248d54ed9
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: Tue Oct 7 18:16:06 2014 +0200

    FindThreads: introduce THREADS_PREFER_PTHREAD_FLAG (#14767)

diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index 7203aa2..fdc1e93 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=decc7d1ef66c31b78f78b68b869396ecd2b2cbee
commit decc7d1ef66c31b78f78b68b869396ecd2b2cbee
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: Tue Oct 7 18:16:06 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..7203aa2 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
+#
+# ::
+#
+#   CMake::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 CMake::Threads)
+  add_library(CMake::Threads INTERFACE IMPORTED)
+
+  if(THREADS_HAVE_PTHREAD_ARG)
+    set_property(TARGET CMake::Threads PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread")
+  endif()
+
+  if(CMAKE_THREAD_LIBS_INIT)
+    set_property(TARGET CMake::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