[vtkusers] Generate debug libraries with _d postfix

Fernando Nellmeldin f.nellmeldin at open-engineering.com
Wed Feb 17 04:52:25 EST 2016


Hello.
This solution worked for me as expected!
I only had to edit the file and rerun configure-generate-compile-install.
Thank you very much.

Fernando.

2016-02-17 0:48 GMT+01:00 Richard Ling <Richard.Ling at cisra.canon.com.au>:

> I also needed to do this recently.  I am no expert on CMake or VTK, but I
> was able to find a way that worked for me.
>
> I use PCL which uses VTK.  PCL already uses different names for libraries
> (eg., pcl_xxx_debug.lib and pcl_xxx_release.lib).
>
> I wanted the PCL debug libs to link with VTK debug libs, and PCL release
> libs to link with VTK release libs.
>
>
>
> Find vtkModuleMacros.cmake, and find the line:
>
>   set_property(TARGET ${_name} PROPERTY OUTPUT_NAME
> ${_vtk}${_name}${_lib_suffix})
>
> I replaced this with:
>
>   set_property(TARGET ${_name} PROPERTY DEBUG_OUTPUT_NAME
> ${_vtk}${_name}${_lib_suffix}_d)
>
>   set_property(TARGET ${_name} PROPERTY RELEASE_OUTPUT_NAME
> ${_vtk}${_name}${_lib_suffix})
>
>
>
> The CMake documentation I referred to for these properties is here:
>
> https://cmake.org/cmake/help/v3.3/command/set_target_properties.html
>
> See the paragraph starting “Properties that affect the name of a target’s
> output file are as follows”.
>
>
>
> Then I opened VTK build in CMake-gui, re-ran “configure”, re-ran “generate”
>
> Opened the updated VTK build files in my IDE (Visual Studio 2015) (using
> Administrator mode, so that the install can succeed)
>
> Rebuilt INSTALL using “debug” configuration, then again using “release”
> configuration
>
> Checked in the VTK install directory, both debug and release libraries are
> there side by side.
>
>
>
> Then repeated all that for PCL: “configure”, “generate”, INSTALL debug,
> INSTALL release.
>
> When I opened the updated PCL build files in the IDE, I could see that the
> debug build of PCL was linking the VTK libs with the “_d” suffix.
>
> Which is exactly what I wanted.
>
>
>
> A final note: my project which uses PCL, uses the Visual Studio IDE build
> system directly (not CMake).
>
> So in the debug build, I had to manually add the “_d” suffix to the VTK
> import libraries.
>
> Otherwise my executable would have loaded both release and debug  versions
> of the same VTK DLL, causing chaos.
>
>
>
> Hope this helps.
>
>
>
> *From:* vtkusers [mailto:vtkusers-bounces at vtk.org] *On Behalf Of *Fernando
> Nellmeldin
> *Sent:* Tuesday, 16 February 2016 3:28 AM
> *To:* ben.boeckel at kitware.com
> *Cc:* vtk-users
> *Subject:* Re: [vtkusers] Generate debug libraries with _d postfix
>
>
>
> Thank you for your response.
>
> I checked the file with the function name, but I didn't know what to do.
>
> For the current time, I guess I could do it manually. It is just a quick
> find & rename that shouldn't take long.
>
>
>
> Fernando.
>
>
>
> 2016-02-12 17:43 GMT+01:00 Ben Boeckel <ben.boeckel at kitware.com>:
>
> On Fri, Feb 12, 2016 at 10:26:18 +0100, Fernando Nellmeldin wrote:
> > However, that doesn't work for VTK 6.3.0 nor VTK 7.0.0. (for 5.10 does
> just
> > what I want).
>
> Probably due to the module system changes for VTK6.
>
> > Any thoughts of how to do the same on these versions?
>
> Some logic could be added to CMake/vtkModuleMacros.cmake:624 or so
> (inside of vtk_module_library) to do this for Windows.
>
> > PS: I'm using CMake with VS2010 generator under windows8, but I think the
> > solution should be general.
>
> Well, at least on Windows. Other platforms don't have the debug/release
> runtime library split and such things are annoying to work with
> elsewhere (I regularly debug a single library and not having to build
> the entire stack because the library name changed is a big plus).
>
> --Ben
> The information contained in this email message and any attachments may be
> confidential and may also be the subject to legal professional privilege.
> If you are not the intended recipient, any use, interference with,
> disclosure or copying of this material is unauthorised and prohibited. If
> you have received this email in error, please immediately advise the sender
> by return email and delete the information from your system.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160217/97f0309c/attachment-0001.html>


More information about the vtkusers mailing list