[cmake-developers] FindPythonInterp.cmake an different major versions

Rolf Eike Beer eike at sf-mail.de
Tue Jan 17 15:52:22 EST 2012


Brad King wrote:
> On 1/17/2012 1:50 PM, Rolf Eike Beer wrote:

> > Today a user was in #cmake that had a system default python that was
> > some 3.x version, and therefore /usr/bin/python was a symlink to
> > /usr/bin/python3. The current module has no possiblity for a developer
> > to specify that FindPythonInterp should search for python2 first. So I
> > wrote the attached patch which allow the developer to say that a
> > python2 or python3 major version should be preferred.
> > 
> > This is actually a bit hacky, but nevertheless "works for him"(tm).
> 
> [snip]
> 
>  > +# You may specify either PYTHONINTERP_PREFER_PYTHON2 or
>  > +# PYTHONINTERP_PREFER_PYTHON3 to tell the module to probe for a
>  > specific +# python major version first.
> 
> Can this use the version argument to find_package?  If a project's
> python code works only with 2 or only with 3 why bother even looking
> for other versions?

No, it can not. This argument gives either a minimum version, or an exact 
version. This way it is impossible to specify that any 2.x version would 
match. It would be enough for 3.x versions, but for that this module has to be 
fixed to actually find 3.x versions at all. Currently it would only find them 
by accident if /usr/bin/python points to one.

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20120117/bfe92a5a/attachment.sig>


More information about the cmake-developers mailing list