[CMake] Cmake doesn't add the -lpthread option

Ryan Pavlik rpavlik at iastate.edu
Tue Jun 8 07:54:18 EDT 2010


On 6/8/10 3:54 AM, Cadio Nicolas (Creative Ingenierie) wrote:
>
> Hi,
>
> I work on a C/C++ project where we use the library POSIX thread (pthread).
>
> We use two compiler (x86_64-redhat-linux and x86_64-unknown-linux-gnu).
>
> When I compile the project with the redhat compiler, cmake adds 
> automatically the option --lpthread to the command line of the 
> compilation
>
> BUT when I use the unknown compiler, cmake doesn't add this option.
>
> I don't understand why cmake doesn't add the --lpthread option with 
> the x86_64-unknown-linux-gnu.
>
> Anybody can help me please to resolve my problem ?
>
> Thanks, nico
>
Are you using the find_package(Threads) command to find the library 
required for threads?  You should not depend on the compiler to 
automatically add that option - if you want threads, use the find module.

Ryan

-- 
Ryan Pavlik
Human-Computer Interaction Graduate Student
Virtual Reality Applications Center
Iowa State University

rpavlik at iastate.edu
http://academic.cleardefinition.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100608/c72a76aa/attachment.htm>


More information about the CMake mailing list