When running targets that depend on a python, such as:
cmake --build . --target test-security-check
cmake --build . --target check-symbols
cmake --build . --target check-security
... it can be tricky to configure cmake to use a python venv. This change checks for the $VIRTUAL_ENV env var and uses python from there using the following logic:
- First check if $VIRTUAL_ENV is set. If it is, use the python binary from this venv.
- Fall back to system python otherwise.