How to build VTK C++ Source C

Official building guide (a little bit out-dated)

VTK/Configure and Build


  • CMake 3.15.0
  • Qt5.12.3 → msvc2015_64
  • Visual Studio 2017 Professional

Download VTK Source code

git clone

Use CMake configure and generate Visual Studio Project

  • Start CMake-GUI

  • Select the appropriate source (git repository) and the build directory (a separated empty folder)

  • Then click the “Configure” button. CMake will ask you to select the generator the first time you press Configure instead of having a drop-down menu in the main dialog.

    • Select generator:”Visual Studio 2017″ and platform: “x64” then click “Finish”

  • Wait til configure finish (5 to 10 minutes)

Editing Entries

Enable Qt

  • Change value of “VTK_GROUP_ENABLE_Qt” from “DEFAULT” to “YES”

  • Add a new entry QT_QMAKE_EXECUTABLE:FILEPATH=<YourQtPath>qmake.exe

Enable OpenGL related modules (optional)

  • Change value of OpenGL related moubles
    • Change value of “VTK_ENABLE_VTK_opengl” from “DEFAULT” to “YES”

    • Change value of “VTK_ENABLE_VTK_RenderingContextOpenGL2” from “DEFAULT” to “YES”

Generate Visual Studio Project

  • Click “Configure” again and make sure all red-background entries disappeared.

  • Then click “Generate” and wait til generating done.

  • Click “Open Project” via Visual Studio 2017 and select “Build → Build Solution”

  • Wait till building done (about 20 minutes)

  • Check .dll you need in <YourBuildPath>\bin\Debug