[CMake] Choose Python version on OS X

Robert Haines rhaines at manchester.ac.uk
Wed Feb 11 07:14:53 EST 2009


On 10 Feb 2009, at 20:59, Enrico Franchi wrote:

> I have python_select and python2.6 is selected. /opt/local/bin is  
> before /usr/bin.
> However
>
> MESSAGE(${PYTHON_INCLUDE_PATH})
>
> says:
>
> /System/Library/Frameworks/Python.framework/Headers

Hmm, you're right. Just tested on mine and it gets it wrong too.

> cmake also prints:
> -- Found PythonLibs: -framework Python
>
> (but I think this is correct in any case).

Yes, that's correct as MacPorts uses Frameworks for Python...

>
> More info:
>
> % which python
> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin// 
> python


I've had a quick look at FindPythonInterp and FindPythonLibs and they  
are inconsistent!

If you add a line to print PYTHON_EXECUTABLE you will see that it  
finds /opt/local/bin/python2.6 but still gets the framework wrong...

I've tried adding /opt/local/Library/Frameworks/${fwk}.framework to  
CMakeFindFrameworks but it still doesn't work.

I think FindPythonLibs needs to look at the version of python it finds  
in the path, then match the correct framework path to that, but it  
isn't doing that right now.

Maybe file a bug? Do you want to or shall I?

Cheers,
Rob




More information about the CMake mailing list