[CMake] CMake finds the wrong Python interpreter on Windows

David Cole david.cole at kitware.com
Thu Feb 25 13:41:44 EST 2010


On Thu, Feb 25, 2010 at 1:29 PM, Bill Hoffman <bill.hoffman at kitware.com>wrote:

> Noel O'Boyle wrote:
>
>
>> Done. I've attached the result (off list). In summary it seems to be
>> searching for python2.6.exe first, instead of python.exe.
>>
>>
> OK, so that is the problem....
>
> It looks for names in this order:
>
> NAMES python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0
> python1.6 python1.5 python
>
>
> It will prefer python2.6 over python in the PATH, and it has no way of
> knowing or caring if one is cygwin or not.  I don't think there is much we
> can do about this.
>
> I should have noticed this:
> C:/Python26/python.exe
>
> C:/Cygwin/bin/python2.5.exe
>
>
> I suppose one fix could be to to have the windows one prefer python over
> any of the named version ones...
>
>
>
Same problem as ever: when multiple versions are installed an automatic
"find" result cannot be relied upon to choose the right one. In that case,
caller should set PYTHON_EXECUTABLE explicitly prior to doing the find call.

On the other hand, we should not have a version/path mismatch between python
exes and libs and headers. We should consistently find one first, and then
find the other stuff relative to that. Or leave that other stuff set as
NOTFOUND if there are no libs/headers relative to the exe.

This should be as easy as changing which Qt is found: change
QT_QMAKE_EXECUTABLE and other stuff gets re-found. Same logic should apply
here: change PYTHON_EXECUTABLE and other stuff should be re-found...


David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100225/2412c095/attachment.htm>


More information about the CMake mailing list