FindPython3: How to find default Python 3 installation
There are two strategies to find the Python interpreter set by Python3_FIND_STRATEGY :
VERSION: Try to find the most recent version in all specified locations. This is the default if policy CMP0094 is undefined or set to OLD.
LOCATION: Stops lookup as soon as a version satisfying version constraints is founded. This is the default if policy CMP0094 is set to NEW.
The second strategy looks a bit too random (and probably not even reproducible on the same system), but I use the first one (through another program). I develop software, that's why I have several versions of Python installed:
$ python -V
Python 3.10.10
$ ls -l /usr/bin/python
lrwxrwxrwx 1 root root 7 Mar 5 23:26 /usr/bin/python -> python3
$ ls -l /usr/bin/python3
lrwxrwxrwx 1 root root 10 Mar 5 23:26 /usr/bin/python3 -> python3.10
However, my CMake finds python3.11
, which is the newest installed version, but this is not my "default" version in the system.
Could there be implemented the third strategy, that would find (or check) the default system-wide python3
version? Maybe it could also be made default, if it looks reasonable.