[CMake] patch proposal for PythonInterp

Rolf Eike Beer eike at sf-mail.de
Thu Mar 21 13:30:29 EDT 2013


Yngve Inntjore Levinsen wrote:
> On 21. mars 2013 12:00, Rolf Eike Beer wrote:
> > Am 21.03.2013 11:03, schrieb Yngve Inntjore Levinsen:
> >> Hi,
> >> 
> >> I have a suggestion for the PythonInterp. On a system I am compiling my
> >> code on, I need to find the python binary which is newer than 2.5.
> >> However, the default /usr/bin/python is 2.4.
> >> 
> >> If I then set the variable (which is not documented in the header by the
> >> way) PythonInterp_FIND_VERSION to 2.5, it will first search for the
> >> 
> >> following list of binary names:
> >>     python2.5 python2 python.
> > 
> > This looks like you are using CMake 2.8.7 or before. Upgrade.

> cmake --version
> cmake version 2.8.10.2
> 
> Have a look at line 64 and 79 of FindPythonInterp.cmake. If e.g.
> PythonInterp_FIND_VERSION is set to 2.5, then _Python_NAMES in line 64
> is equal to "python2.5;python2;python" It then finds python2 or python.
> Since PYTHON_EXECUTABLE then is found in line 79, it does not check the
> other versions (2.6 and 2.7). Or?

Oh, you are right. It takes the other versions only into account after doing a 
first find attempt. This is because it tries to pick up the systems default 
python for a given major first, e.g. whatever you have configured for python 
2.x. But what it doesn't do is drop and search more if that is a too old 
version. Patches welcome.

Eike
-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130321/4dfede13/attachment.pgp>


More information about the CMake mailing list