[vtk-developers] VTK CVS link error, .mm files, VTK_REQUIRED_OBJCXX_FLAGS, and vtkCoreGraphicsGPUInfoList.mm

Sean McBride sean at rogue-research.com
Wed Feb 24 20:18:43 EST 2010


Hi all (especially François I think),

I updated from CVS and although VTK itself builds, my application no
longer links against it.  This is because of the new
vtkCoreGraphicsGPUInfoList.mm.  Happily, it will be straightforward to fix.

1) Objective-C (.m) & Obj-C++ (.mm) code can be compiled using either
garbage collection or reference counting mode.  Any library that an app
links to must be built the same way.  So as a library, VTK must (and
does) support both.

The choice is decided by compiler flag (ex -fobjc-gc).  gcc accepts this
flag only for .m and .mm files (complains otherwise).  Alas, CMake does
not have an Objective-C equivalent of CMAKE_CXX_FLAGS, see:
<http://public.kitware.com/Bug/view.php?id=4756>

So instead, VTK provides the CMake variable VTK_REQUIRED_OBJCXX_FLAGS
which it is supposed to pass to all .mm files when compiled.  It mostly
does.  See Rendering/CMakeLists.txt.  But it does _not_ do this for the
new vtkCoreGraphicsGPUInfoList.mm (and I just noticed it's also missing
for vtkCocoaTkUtilities.mm also).

It's a maintenance pain to have to remember this every time a new .mm
file is added.  Is there some CMake magic that can be done so that
all .mm files are always compiled with VTK_REQUIRED_OBJCXX_FLAGS?


2) In any case, vtkCoreGraphicsGPUInfoList.mm doesn't contain any
Objective-C anyway! (except for a use of #import that could change to
#include) so it should probably be renamed .cxx, unless adding Obj-C
code to this file is planned....?

Thanks,

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada





More information about the vtk-developers mailing list