[CMake] Problem embedding Python in C

Ángel Alonso feler at archlinux.us
Wed Jun 10 02:12:11 EDT 2009


On 09/06/09 11:22, Eric Noulard wrote:
> .2009/6/10 Ángel Alonso<feler at archlinux.us>:
>    
>> Hi,
>>
>> I'm using cmake for a project that embed Python in  C.
>>
>> For include the Python libs i use: include(FindPythonLibs)
>>      
>
> One usually do:
>
> find_package(PythonLibs)
> instead of:
> include(FindPythonLibs)
>
>    
>> But compiling, I get this errors:
>>
>> /usr/lib/python2.6/config/libpython2.6.a(posixmodule.o): In function
>> `posix_tmpnam':
>> (.text+0x8f4): warning: the use of `tmpnam_r' is dangerous, better use
>>      
> [...]
>
>
> include(FindPythonLibs) may not be enough:
> you seem to be missing something like:
>
> target_link_library(<your_target>  ${PYTHON_LIBRARIES})
>
> [...]
>
>    
>> I also try include(FindThreads) but the problem persist.
>>      
>
> Same for FindThreads.
>
> find_package(Threads)
>
> however I dont' know that one works because the FindThreads.cmake
> module does not seem to define THREADS_LIBRARIES
> in order for you to
> target_link_library(<your_target>  ${THREADS_LIBRARIES})
>
> May be the author of FindThreads may help us with the usage of this module?
>
>    
>> I think that is a problem of cmake, because in other tests that I made (with
>> a simple Makefile, not cmake) it works.
>>      
>
> compare the link command used by CMake and te one you use in your makefile.
>
> make VERBOSE=1
>
> with CMake generated makefile should show you the full link line.
>
>    
Thanks for your help,

I did what you said, and it works! I only had to link lib pthreads and 
lib util.

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


More information about the CMake mailing list