FindPython3 does not find VirtualEnvs First by Default
As documented in FindPython3 Python3_FIND_VIRTUALENV
has the default value FIRST
. In fact this is the case on Windows, but when running CMake on linux it does not select the current VirtualEnv of python, but the system interpreter.
Thus I had to explicitly set the Python3_FIND_VIRTUALENV to make cmake find the current virtualenv:
set(Python3_FIND_VIRTUALENV FIRST) # <- without this line the current virtualenv is only found on windows, not on linux
find_package(Python3 COMPONENTS Interpreter Development)