How to build VTK-9.1.0 Static Library?

I have built VTK-9.1.0 Static library by keeping BUILD_SHARED_LIBS = OFF.
But when I use this library in my module[vtkDlgApp] I get Linking errors.

Severity Code Description Project File Line Suppression State
Error LNK2038 mismatch detected for ‘RuntimeLibrary’: value ‘MDd_DynamicDebug’ doesn’t match value ‘MTd_StaticDebug’ in StdAfx.obj vtkDlgApp D:\DataDesignProjects\VTK_Examples\Build\vtkDLG\vtkRenderingOpenGL2-9.1d.lib(vtkRenderingOpenGL2ObjectFactory.obj) 1

vtkDlgApp: Project settings
Use of MFC = Use Standard Windows Libraries
Runtime Library = Multi-threaded Debug (/MTd)

If I change the porject settings to dynamic then vtkDlgApp exe is built.
Use of MFC =Use MFC in a Shared DLL
Runtime Library = Multi-threaded Debug DLL (/MDd)

I think, there is problem in VTK-9.1.0 Static library .
So can anybody help building the VTK-9.1.0 Static library and using it in a MFC dialog module?

Thanks in advance . :slight_smile:

cmake_dependent_option(VTK_ENABLE_KITS “Enable kits compilation” OFF

Static builds don’t make sense with kits. Ignore the flag if shared

libraries aren’t being built.


what does this mean ?

It means that a static kit build makes no sense. So if you’re making a static build, the user’s kit request is just ignored and treated as if it is off.

As for the main question…it seems you’re trying to request a Debug build from CMake, but then try to use a release version of MFC. This is not supported. If this isn’t correct, more specific information will be needed.