In Windows using Anaconda Python 3.7.1, I had to switch this off in order to get a build. I was getting the following error: LINK : fatal error LNK1104: cannot open file 'python37.lib'
It relates to this commit:
Merge topic ‘reenable-vtk-python-optional-link’
4c9c2e1a7a Remove the block preventing the use of VTK_PYTHON_OPTIONAL_LINK
I also had to set VTK_PYTHON_OPTIONAL_LINK=OFF
and VTK_WINDOWS_PYTHON_DEBUGGABLE=ON
to get it to build with Visual Studio 2017 on Windows 10 from the VTK master branch
I suspect that the VTK::Python code needs an update in the face of VTK_WINDOWS_PYTHON_DEBUGGABLE to use the debug library target. I don’t have Windows handy at the moment, but if you want to delve in, changing the vtk_python_target variable based on it would be the place to focus on.
It turns out VTK_PYTHON_OPTIONAL_LINK is off and hidden by default on Windows, so that wasn’t the issue.
The solution seems to be that VTK_WINDOWS_PYTHON_DEBUGGABLE should default to ON when building in debug mode, but I think that would require a feature change for CMake cmake_dependent_option()