<div class="gmail_quote">On Sun, Sep 20, 2009 at 3:02 PM, Hendrik Sattler <span dir="ltr">&lt;<a href="mailto:post@hendrik-sattler.de">post@hendrik-sattler.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Am Sonntag 20 September 2009 17:16:19 schrieb Philip Lowman:<br>
<div><div></div><div class="h5">&gt; Hello,<br>
&gt;<br>
&gt; I&#39;ve merged (optional) Pthreads-win32 support into a FindThreads.cmake<br>
&gt; attached in the tracker and added some documentation on how to use it.<br>
&gt; Since FindThreads isn&#39;t my module I wanted to throw this up on the mailing<br>
&gt; list for feedback.<br>
&gt;<br>
&gt; <a href="http://www.cmake.org/Bug/view.php?id=6399" target="_blank">http://www.cmake.org/Bug/view.php?id=6399</a><br>
&gt;<br>
&gt;<br>
&gt; Also, in regard to a previous mailing list thread about FindThreads...<br>
&gt;<br>
&gt; I&#39;m not sure which platform the block &quot;Check if compiler accepts -pthread&quot;<br>
&gt; is executed on.  The documentation I attached to the code advises calling<br>
&gt; &quot;target_link_libraries(target ${CMAKE_THREAD_LIBS_INIT})&quot;.  After grokking<br>
&gt; the code a bit further I&#39;m now guessing this &quot;-pthread&quot; argument is<br>
&gt; technically accepted by the linker and not needed by the compiler, but it<br>
&gt; would be nice to know this for sure to ensure the documentation is correct.<br>
<br>
</div></div>gcc says:<br>
-pthread<br>
           Adds support for multithreading with the pthreads library.  This<br>
           option sets flags for both the preprocessor and linker.<br>
<br>
So it may work to only use it during linking but this may cause subtle failure<br>
on some platforms.<br>
<br>
When writing FindThreads.cmake, it would be better to really rewrite it and<br>
use the common naming standards for cmake modules.<br></blockquote><div><br>I&#39;m hesitant to rewrite anything that works, especially if it works on platforms I don&#39;t have access too. :)<br><br>Include &amp; library variables probably could be added if it can be done in a safe way with the compile checks already in place.<br>
<br>Not sure on -pthread, we&#39;ve never added it to our gcc command lines before.  Looking at the man page, it&#39;s only a compile flag under IA-64, RS-6000, PPC, and SPARC.  Would recommending people add it to their compiler flags and only rely on the output of ${CMAKE_THREAD_LIBS_INIT} for linking be the right thing to do?<br>
<br></div></div>-- <br>Philip Lowman<br>