Adding configurable paraview resource_dir

I am building ParaView with an external VTK. Everything looks fine, except that ParaView cannot find the documentation or examples.

I investigated a bit into the function:

std::string vtkPVFileInformation::GetParaViewSharedResourcesDirectory()
{
  // Look for where the function "GetVTKVersion." lives.
  auto vtk_libs = vtkGetLibraryPathForSymbol(GetVTKVersion);

  // Where docs might be in relation to the executable
  std::vector<std::string> prefixes = {
#if defined(_WIN32) || defined(__APPLE__)
    ".."
#else
    "share/paraview-" PARAVIEW_VERSION
#endif
  };

  // Search for the docs directory
  vtkNew<vtkResourceFileLocator> locator;
  auto resource_dir = locator->Locate(vtk_libs, prefixes, "doc");
  if (!resource_dir.empty())
  {
    resource_dir = vtksys::SystemTools::CollapseFullPath(resource_dir);
  }

  return resource_dir;
}

When building ParaView with an external VTK, we cannot infer resource_dir from the path of VTK’s libraries, since those come from a different installation. As a potential fix, could we instead infer resource_dir from ParaView’s own libraries or main executable?

Also, I would suggest making prefixes configurable via a CMake option. For example, we might want to set prefixes = "share/paraview" when PARAVIEW_VERSIONED_INSTALL is OFF.

These are good points. Can you please file an issue about it? We can split subtasks off from there.

Cc: @cory.quammen @danlipsa

https://gitlab.kitware.com/paraview/paraview/-/issues/23043