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

Brad King brad.king at kitware.com
Tue Jan 17 16:25:59 EST 2012


On 1/17/2012 3:52 PM, Rolf Eike Beer wrote:
> Brad King wrote:
>> 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.

Actually the find_package command documents that argument as

   "The [version] argument requests a version with which the
    package found should be compatible"

so it is looking for compatible versions, not greater versions.
The meaning of "compatible" is package-specific.  That's why each
Find module needs to do its own test, or in Config mode it checks
for the FooConfigVersion.cmake file and uses that to do the test.

Therefore I would expect

   find_package(PythonInterp 2)

to find a python interpreter compatible with version 2, which does
not include version 3.  You just can't use the normal version
check from the standard find helper module.

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

Shouldn't that be part of this fix?

-Brad



More information about the cmake-developers mailing list