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

Brad King brad.king at kitware.com
Tue Jan 17 15:21:55 EST 2012


On 1/17/2012 1:50 PM, Rolf Eike Beer wrote:
> Commit 20980ef56a847fec7922983257fd5be467b689bd changed the FindPythonInterp

For reference:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20980ef5

> 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?

-Brad



More information about the cmake-developers mailing list