[CMake] What is the proper cross-platform way to link the Python library?

Arjen Markus arjen.markus at deltares.nl
Sun Jan 6 09:54:41 EST 2013


On Sun, 06 Jan 2013 11:08:37 +0100
  Rolf Eike Beer <eike at sf-mail.de> wrote:

> This will work as long as PYTHON_LIBRARIES contains only 
>one element.
> 
> The debug/optimized keywords apply only to the 
>immediately following library, so if you have a list of 
>libraries returned (currently unlikely AFAIK) it may 
>still cause bad results.
> 
> Have a look at the SelectLibraryConfigurations module, 
>it does what you did above and in 2.8.10.* also properly 
>handles lists and the case where both values are the 
>same.
> 
> And from what I see (at least in the current code) 
>FindPythonLibs already does exaclty that. So which CMake 
>version is Arjen using? And if it is the most recent one, 
>can you get him to debug why FindPythonLibs doesn't work 
>as expected?
> 

I am using CMake version 2.8.10.2 (but IIRC the problem
also occurred with 2.8.7).

My interpretation of the problem at the moment is:
- The pyconfig.h header file introduces a dependency of
   a library "python27_d.lib" directly in the object file
   - this is the consequence of the pragma.
- There is no such library in the Python installation,
   so the linker will always complain that this library
   is missing - quite independent of what CMake does.
   (In fact, the generated Makefiles and associated files
   do not refer to this library at all)

I tried copying the ordinary library to "python27_d.lib"
but that led to several unresolved symbols. So there is
more going on than just name mangling.

Regards,

Arjen

 

DISCLAIMER: This message is intended exclusively for the addressee(s) and may contain confidential and privileged information. If you are not the intended recipient please notify the sender immediately and destroy this message. Unauthorized use, disclosure or copying of this message is strictly prohibited.
The foundation 'Stichting Deltares', which has its seat at Delft, The Netherlands, Commercial Registration Number 41146461, is not liable in any way whatsoever for consequences and/or damages resulting from the improper, incomplete and untimely dispatch, receipt and/or content of this e-mail.






More information about the CMake mailing list