[CMake] Python version specification in FindPythonInterp is ignored

Rolf Eike Beer eike at sf-mail.de
Tue Jun 26 13:18:18 EDT 2012


> Actually, clearing the cache worked for FindPythonInterp but I still can't
> get FindPythonLibs.cmake to work. Same problem .... it can find the 2.4
> version but not the 2.7 version - and gives an error when 2.7 is required.
> Obviously, I cleared the cache this time. Again, is there a hint I can
> give to help it find the version I want?

You already got an answer regarding CMAKE_PREFIX_PATH which should fix
most of your issue.

But I wonder if we should import what the current FindPythonLibs.cmake
from kdelibs does: ask the found python interpreter for it's library first
and use that if available. In most cases I assume that you want to get a
python library that matches your default python interpreter (or a
specified one). So doing find_package(PythonLibs 3.2) would search for
python3.2, then ask it for the library and then fall back to the usual
searching.

I don't do any python stuff, I just cleaned up all the version number
stuff in there and argue with the Gentoo CMake maintainers because they
keep adding stuff that breaks the version selection later. From what I was
able to get out of them the above should fit their needs too (even if they
were not able until today to specify what they would see as the "right"
behavior of this at all).

This is certainly nothing for 2.8.9, but something that I would do shortly
after to get maximum testing until 2.8.10. Opinions?

Eike


More information about the CMake mailing list