[vtkusers] Windows: Correctly linking the debug and release libraries in a CMake-based project
Michael Jackson
mike.jackson at bluequartz.net
Tue Jan 26 11:45:58 EST 2010
On Jan 26, 2010, at 11:42 AM, John Drescher wrote:
> 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
I think he is talking about having the vtk libs have "_debug" or "_D"
or "D" in the name when they are built as debug versus Release builds.
What works for ITK is to actually build both the debug and release
versions but DO NOT install them. Then set an environment variable
VTK_DIR to point to the build directory of VTK. CMake will do the
rest. This at least worked for me with ITK and allowed me to switch
between debug and release builds in my own project without getting all
the linker warnings/errors in MSVC. The other suggestion was to build
"Release W/Debug Info" and install that.
___________________________________________________________
Mike Jackson www.bluequartz.net
Principal Software Engineer mike.jackson at bluequartz.net
BlueQuartz Software Dayton, Ohio
More information about the vtkusers
mailing list