-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Despite running my build in a Python virtual environment, created by /usr/bin/python3, CMake somehow manages to find /usr/bin/python3.11 (FWIW /usr/bin/ptyon3 is a sym link of 3.8). IMHO it should first find the virtual environment version (arguably that's the whole point of the virtual environment), but it would also be understandable if it found /usr/bin/python3 (albeit less desirable). The fact that it found python3.11 is unexpected (at least to me).
Here is where Python is detected. Off the top of my head I'm not sure what needs to change to make the detection more reasonable.
Edit: it looks like a workaround is for the user to add set(Python3_FIND_VIRTUALENV ONLY) to their toolchain. Maybe we can resolve this issue by setting Python3_FIND_VIRTUALENV to FIRST (if it's not set) before calling find_package(Python3)?
Edit 2: CMake seems to still be finding /usr/bin/python3.11 for me, even after setting Python3_FIND_VIRTUALENV to ONLY. Hmm...
Edit 3: Tried adding set(Python3_ROOT_DIR /path/to/venv) to my toolchain.cmake and still am getting /usr/bin/python3.11...
Edit 4: Finally got it to work by adding set(Python3_EXECUTABLE /path/to/venv/bin/python3) in my toolchain file.