Error building 8.2.0 on macOS Mojave

Hi –

When building VTK 8.2.0 on macOS Mojave, configured with VTK_USE_X=ON
and VTK_USE_COCOA=OFF, I get this error:

[ 42%] Linking CXX shared library ../../lib/libvtkRenderingOpenGL2-8.2.dylib
Undefined symbols for architecture x86_64:
  "_glXChooseFBConfig", referenced from:
      vtkXOpenGLRenderWindowTryForFBConfig(_XDisplay*, int, int, int, int, int, bool) in vtkXOpenGLRenderWindow.cxx.o
  "_glXCreateContext", referenced from:
      vtkXOpenGLRenderWindow::CreateAWindow() in vtkXOpenGLRenderWindow.cxx.o
[.....]
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libvtkRenderingOpenGL2-8.2.1.dylib] Error 1
make[1]: *** [Rendering/OpenGL2/CMakeFiles/vtkRenderingOpenGL2.dir/all] Error 2
make: *** [all] Error 2

If I don’t use the default values for OPENGL_INCLUDE_DIR,
OPENGL_gl_LIBRARY, and OPENGL_glu_LIBRARY, and instead set them like this:

 OPENGL_INCLUDE_DIR               /opt/local/include 
 OPENGL_gl_LIBRARY                /opt/local/lib/libGL.dylib 
 OPENGL_glu_LIBRARY               /opt/local/lib/libGLU.dylib

then I get this error:

[ 38%] Linking CXX shared library ../../lib/libvtkRenderingOpenGL2-8.2.dylib
Undefined symbols for architecture x86_64:
  "_kCFCoreFoundationVersionNumber", referenced from:
      vtkOpenGLRenderer::HaveApplePrimitiveIdBug() in vtkOpenGLRenderer.cxx.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [lib/libvtkRenderingOpenGL2-8.2.1.dylib] Error 1
make[1]: *** [Rendering/OpenGL2/CMakeFiles/vtkRenderingOpenGL2.dir/all] Error 2
make: *** [all] Error 2

I’m using X11 modules from MacPorts, and the /opt/local values allowed
earlier versions of VTK to build for both X11 and Cocoa builds,
(although I never got the X11 build to run correctly).

Any suggestions as to what I might be missing would be appreciated.

Thanks.
– Steve