[CMake] cmake vs. Python 3.4

Roger Leigh rleigh at codelibre.net
Fri Dec 23 16:11:48 EST 2016



On 23/12/16 20:53, Alan W. Irwin wrote:
> On 2016-12-23 20:57+0100 Lev wrote:
>
>> Hi list,
>>
>>
>> I have this:
>>
>> FIND_PACKAGE(PythonInterp)
>>
>> and cmake finds this:
>>
>> -- Found PythonInterp: /usr/bin/python (found version "2.7.9")
>>
>> However, 3.4 is also installed. How can I specify to find 3.4?
>>
>> If I say:
>>
>> set(Python_ADDITIONAL_VERSIONS 3.4)
>> FIND_PACKAGE(PythonInterp 3 REQUIRED)
>>
>> still no luck.
>>
>> This is on a Debian stable, so
>>
>> $ cmake --version
>> cmake version 3.0.2
>
> Try using the update-alternatives command so that "python" becomes
> symbolically linked to python-3.4 rather than python-2.7.9
>
> Or uninstall python 2.7.9.

This seems a little drastic; I wouldn't expect to have to alter the 
system for cmake to do what I want.  Does FindPython not have logic to 
check the versioned pythonx.y alternatives when doing these checks?  Why 
isn't it checking the python3 and python3.x commands in this circumstance?

Or, give the incompatibility here, do we need a separate 
FindPython3Interp and equivalents so that we can find Python 2 and 3 
version of the executable and libs independently.  This is something 
which has been bugging me for a while since the current behaviour seems 
somewhat unsatisfactory.


Regards,
Roger


More information about the CMake mailing list