<div class="gmail_quote">On Mon, Sep 21, 2009 at 6:07 AM, Marcel Loose <span dir="ltr">&lt;<a href="mailto:loose@astron.nl">loose@astron.nl</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;">
<div><div></div><div class="h5">On Sun, 2009-09-20 at 19:32 -0400, Philip Lowman wrote:<br>
&gt; On Sun, Sep 20, 2009 at 3:02 PM, Hendrik Sattler<br>

&gt;<br>
&gt; I&#39;m hesitant to rewrite anything that works, especially if it works on<br>
&gt; platforms I don&#39;t have access too. :)<br>
&gt;<br>
&gt; Include &amp; library variables probably could be added if it can be done<br>
&gt; in a safe way with the compile checks already in place.<br>
&gt;<br>
&gt; Not sure on -pthread, we&#39;ve never added it to our gcc command lines<br>
&gt; before.  Looking at the man page, it&#39;s only a compile flag under<br>
&gt; IA-64, RS-6000, PPC, and SPARC.  Would recommending people add it to<br>
&gt; their compiler flags and only rely on the output of<br>
&gt; ${CMAKE_THREAD_LIBS_INIT} for linking be the right thing to do?<br>

<br>
</div></div>Hmm, don&#39;t know if the documentation is correct.<br>
<br>
I tested this on Linux x86_64 (gcc 4.3) and on an old i686 (gcc 3.2). On<br>
both systems, when I diff the output of &#39;gcc -E -dM&#39; and &#39;gcc -E -dM<br>
-pthread&#39; I get &#39;#define _REENTRANT 1&#39;.<br>
<br>
So, -pthread clearly defines an extra preprocessor variable.<br></blockquote><div><br>We&#39;ve always defined _REENTRANT manually and specified -lpthread but looking into this further I&#39;m guessing we&#39;re just getting lucky since we&#39;ve never built on platforms where this doesn&#39;t work.<br>
<br><a href="http://stackoverflow.com/questions/875789/gcc-do-i-need-dreentrant-with-pthreads">http://stackoverflow.com/questions/875789/gcc-do-i-need-dreentrant-with-pthreads</a><br><br>Also regarding the lack of a global -pthread in the docs, this post was kind of illuminating.<br>
<br><a href="http://lists.freebsd.org/pipermail/freebsd-threads/2003-September/001202.html">http://lists.freebsd.org/pipermail/freebsd-threads/2003-September/001202.html</a><br><br>So the gist of it is, if your only Unix compiler is gcc and if you add &quot;-pthread&quot; to your CMAKE_C_FLAGS/CMAKE_CXX_FLAGS you really have no need for FindThreads at all, as far as I can tell.<br>
<br></div></div>-- <br>Philip Lowman<br>