[vtkusers] Generate debug libraries with _d postfix
Chungzuwalla
richard at research.canon.com.au
Tue Feb 16 19:16:08 EST 2016
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.
--
View this message in context: http://vtk.1045678.n5.nabble.com/Generate-debug-libraries-with-d-postfix-tp5736543p5736601.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list