Use Python3::Interpreter instead of Python3_EXECUTABLE
Summary
This changes the python utilities to use a target (Python3::Interpreter
) instead of a variable (Pyhton3_EXECUTABLE
). This is because targets can be made persistent on super builds across scopes, whereas variables have directory and function scopes. In particular, the target Python3::Interpreter
expands to Pyhton3_EXECUTABLE
when invoked in a command context, therefore this is completely backwards compatible. However, when dune modules are called from a super directory (see !1391 (closed)), the Python3_EXECUTABLE
will not be present for other modules whereas the target will be globally available if CMAKE_FIND_PACKAGE_TARGETS_GLOBAL
is set to TRUE.
Note: Python3_EXECUTABLE
is still present in the virtual env set up, but this is fine because this is immediately run after finding python (i.e. the variable is used in the local scope) so there is no scoping problems there.