My question is, mainly to @jcfr if there is a better solution for this, other than manually adding these variables to the subproject CMake files that fail to configure in this case. Thanks!
Currently, passing the variables is a sensible approach.
To streamline this, few possible approaches:
(1) Update upstream VTK so that these variables are configured into vtk-config (or alike) and ensure project build against a VTK build tree would find the expected python. Now tracked in https://gitlab.kitware.com/vtk/vtk/-/issues/18328
(2) In case (1) doesn’t work out, update the Slicer/VTK fork to include relevant changes. Though … would prefer to minimize Slicer specific changes in our fork and try to only include backported changes.
This is why we need to pass both set of variables ( PYTHON_* and Python3_*) and it may be challenging to have both sets configured into the VTK build tree …