[Insight-developers] Explicit instantiation linking issues on mac platform

Hans Johnson hans-johnson at uiowa.edu
Wed Sep 6 11:20:21 EDT 2006


Hello Fellow Developers!

I wanted to alert the group to a small issue with linking on mac platform
with explicit instantiation, and get some advice on how to fix the problem.

The issue is that when explicit instantiation is used the extra
ITKCommonExplicit library needs to be linked into the applications along
with ITKCommon library.  The file  Insight/Code/Common/CMakeLists.txt  code
has the following

IF(ITK_EXPLICIT_INSTANTIATION)
  TARGET_LINK_LIBRARIES (ITKCommon ITKCommonExplicit)
ENDIF(ITK_EXPLICIT_INSTANTIATION)

Which I interpret as "ITKCommon depends upon ITKCommonExplicit, so whenever
you use -lITKCommon then also follow with -lITKCommonExplicit during linking
stages".  The problem is that the linking dependancies are backwards, and
that ITKCommonExplicit needs to preceed ITKCommon.

What needs to happen is that somehow ITKCommonExplicit needs to be prepended
to many of the linking stages.

I would like some guidance on resolving this issues, because the "easy way"
touches quite a lot of CmakeLists.txt files and adds complexity to linking
logic.


Regards,
Hans

Food For Thought---Another less intrusive way to do this would be to have
conditionals in the Insight/Code/Common/CMakeLists.txt file that builds the
explicit instantiations right into the ITKCommon library rather than having
a separate library.  This will make life a lot easier as the number and
names of the library linking would be constant across configuration options.




More information about the Insight-developers mailing list