On Mon, 2009-09-21 at 23:25 -0400, Philip Lowman wrote: > On Mon, Sep 21, 2009 at 6:07 AM, Marcel Loose <lo...@astron.nl> wrote: > > On Sun, 2009-09-20 at 19:32 -0400, Philip Lowman wrote: > > On Sun, Sep 20, 2009 at 3:02 PM, Hendrik Sattler > > > > I'm hesitant to rewrite anything that works, especially if > it works on > > platforms I don't have access too. :) > > > > Include & library variables probably could be added if it > can be done > > in a safe way with the compile checks already in place. > > > > Not sure on -pthread, we've never added it to our gcc > command lines > > before. Looking at the man page, it'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? > > > Hmm, don't know if the documentation is correct. > > I tested this on Linux x86_64 (gcc 4.3) and on an old i686 > (gcc 3.2). On > both systems, when I diff the output of 'gcc -E -dM' and 'gcc > -E -dM > -pthread' I get '#define _REENTRANT 1'. > > So, -pthread clearly defines an extra preprocessor variable. > > We've always defined _REENTRANT manually and specified -lpthread but > looking into this further I'm guessing we're just getting lucky since > we've never built on platforms where this doesn't work. > > http://stackoverflow.com/questions/875789/gcc-do-i-need-dreentrant-with-pthreads > > Also regarding the lack of a global -pthread in the docs, this post > was kind of illuminating. > > http://lists.freebsd.org/pipermail/freebsd-threads/2003-September/001202.html > > So the gist of it is, if your only Unix compiler is gcc and if you add > "-pthread" to your CMAKE_C_FLAGS/CMAKE_CXX_FLAGS you really have no > need for FindThreads at all, as far as I can tell. > > > -- > Philip Lowman
Well, yes, unless you're considering Mac OSX a Unix system as well, which IMHO it is, nowadays. GCC gives an 'unsupported option' warning when specifying '-pthread'. So clearly, '-pthread' is not supported on Mac OSX. Marcel Loose _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake