[vtkusers] Windows: Correctly linking the debug and release libraries in a CMake-based project

John Drescher drescherjm at gmail.com
Tue Jan 26 11:42:30 EST 2010


On Tue, Jan 26, 2010 at 11:36 AM, Lars Bilke <lars.bilke at ufz.de> wrote:
> Hi vtk users,
>
> I want to use VTK in a large multiplatform (Win, Linux, Mac) project.
> The projects build configution is driven by CMake. Under windows VTK is
> not really usable with CMake for me:
>
> When I built VTK from source with the help of CMake and Visual Studio
> and built the INSTALL target I can only install one configuration: debug
> OR release because of the identical naming of the debug and release libs.
> Because I also Qt the following issue also occurs:
>
> http://www.itk.org/Wiki/VTK_FAQ#Shared_builds_of_VTK_and_debugging_QVTKWidget_using_Visual_Studio
>
> On the VTK-FAQ page a manual workaround for this problem is given but
> the workaround is not "the CMake-way"-like.
>
> Sure, if I don´t install vtk through the install target and don´t use
> find_package(VTK) and INCLUDE( ${VTK_USE_FILE} ) I can set all the
> include and linker paths to the paths where I built VTK manually in my
> project but that is not a convenient solution.
>
> I know that this problem was already discussed here on the list but no
> good solution was given.
>
> So can someone with more insight in VTKs CMake internals help me out?
>

When you build VTK using CMake the .lib .dll may have the same name
but they are in different folders. CMake understands this and will
properly link your application with the correct .lib. This happens if
you do build both debug and release vtk.

John



More information about the vtkusers mailing list