How does one specify Mesa's GL should be used when compiling VTK (9.0.0.rc2)

I am on a linux system whose system GL version is insufficient for VTK.
I have compiled Mesa-17.2.8 (with LLVM 5.0.0)

I have tried adding to the cmake command when building VTK:

This is how I compiled VTK-8 in the past for this system (for on screen rendering).

I see this during cmake’s configure:

  • Found OpenGL: /usr/lib64/ found components: OpenGL GLX
    so it appears that Mesa GL won’t be used.

How can I compile VTK-9 with Mesa as GL for onscreen rendering?

I am using CMake 3.12.4.

I may have figured it out:
Also use
and change
-DOPENGL_gl_LIBRARY to also list the path to

The component names in FindOpenGL don’t reflect the implementation used, so using Mesa won’t really mention that at all. On our Mesa tester, OPENGL_opengl_LIBRARY is also set to the same as OPENGL_gl_LIBRARY, but that may be vestigal and probably should be empty as you have seen.