[osg-users] Building with DCMTK that uses libiconv

Andrew Janke floss at apjanke.net
Mon Dec 7 14:36:35 PST 2015


Hi, OpenSceneGraph folks.

I ran in to an issue while building OpenSceneGraph on Mac OS X the other 
day. DCMTK can be built with libiconv support, in which case any program 
linking in dcmtk will also need to link in libiconv. The OpenSceneGraph 
build script seems to assume that dcmtk was built without libiconv, so 
doesn't attempt to link it.


Originally found this through a report to Homebrew:

https://github.com/Homebrew/homebrew/issues/46356
https://github.com/Homebrew/homebrew/pull/46388


Homebrew's dcmtk is always built with libiconv, so as a workaround we 
just hacked it to unconditionally link libiconv.

diff --git a/src/osgPlugins/dicom/CMakeLists.txt b/src/osgPlugins/dicom/CMakeLists.txt
index 55c2a57..e6e3f4a 100644
--- a/src/osgPlugins/dicom/CMakeLists.txt
+++ b/src/osgPlugins/dicom/CMakeLists.txt
@@ -5,7 +5,7 @@ IF  (DCMTK_FOUND)

      SET(TARGET_SRC ReaderWriterDICOM.cpp )

-    LINK_LIBRARIES(${DCMTK_LIBRARIES} ${ZLIB_LIBRARY})
+    LINK_LIBRARIES(${DCMTK_LIBRARIES} iconv ${ZLIB_LIBRARY})

      ADD_DEFINITIONS(-DUSE_DCMTK)


That won't work in general though; seems like the build script would 
need to query dcmtk to see if it used libiconv and detect libiconv's 
installation location as well. The dcmtk installation includes a 
lib/cmake directory with information on how dcmtk was built; that might 
be an easy way to get at it.

Cheers,
Andrew Janke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151207/62bd0d14/attachment-0001.htm>


More information about the osg-users mailing list