[Insight-users] ITK_USE_SYSTEM_GDCM ITK V4

Rômulo Pinho romulo.pinho at lyon.unicancer.fr
Mon Nov 5 07:17:31 EST 2012


Hello again, everyone,

Concerning the issues in the enclosed message, I guess I found what I 
should change to make ITK import the GDCM library paths. Patching 
ITK_SOURCE_DIR/Modules/ThirdParty/GDCM/CMakeLists.txt as below

###
if(ITK_USE_SYSTEM_GDCM)
   set(ITKGDCM_SYSTEM_INCLUDE_DIRS
     ${GDCM_INCLUDE_DIRS}
     )
   set(ITKGDCM_INCLUDE_DIRS ${GDCM_INCLUDE_DIRS})
+  set(ITKGDCM_SYSTEM_LIBRARY_DIRS ${GDCM_LIBRARY_DIRS})
   set(ITKGDCM_LIBRARIES ITKGDCM)
else()
###

updated ITK_GDCM_LIBRARY_DIRS with the correct value. Would anyone know 
if this is indeed the right place for the change?
Thanks again,
Rômulo

On 11/02/2012 04:30 PM, Rômulo Pinho wrote:
> Hello,
>
> I'd like to bring back the thread 
> http://www.itk.org/pipermail/insight-users/2011-December/043218.html, 
> because it seems to me that there is still something broken in ITKv4 
> comipilation with ITK_USE_SYSTEM_GDCM (GDCM 2.x).
>
> Despite the corrections made in 
> http://review.source.kitware.com/#/c/1712/, I find it strange that we 
> must make-install GDCM even if we're compiling/linking ITK with GDCM's 
> build tree (as described in the thread above). The make-install 
> solution only works if the installation folder is a "system" folder, 
> which is added to the link directives by default. I think it's even a 
> dangerous solution if we are, eg, testing a new GDCM version and 
> trying to link with its own build tree, while "silently" linking with 
> an old (previously make-installed) version, since the latter is the 
> one the linker will actually find.
>
> Patching ITK_SOURCE_DIR/Modules/ThirdParty/GDCM/itk-module-init.cmake 
> as below
>
> ###
> option(ITK_USE_SYSTEM_GDCM "Use an outside build of GDCM." OFF)
> mark_as_advanced(ITK_USE_SYSTEM_GDCM)
>
> if(ITK_USE_SYSTEM_GDCM)
>   find_package(GDCM REQUIRED)
> +  include(${GDCM_USE_FILE})
> endif()
> ###
>
> seems to solve the problem.
>
> However, ITKConfig doesn't import the library paths exported by GDCM, 
> so in the end I get "-lgdcmXXX not found" erros when linking my 
> program with ITKv4 + (a non-make-installed) SYSTEM_GDCM. After 
> building ITK, I noticed that ITKGDCM_LIBRARY_DIRS is empty in (BUILD 
> or INSTALL)_DIR/lib/cmake/ITK-4.2/Modules/ITKGDCM.cmake, in contrast 
> with ITKGDCM_INCLUDE_DIRS, which does contain the right paths (i.e., 
> those exported by GDCM). Manually updating ITKGDCM_LIBRARY_DIRS does 
> solve the problem, but I'm not a cmake expert and couldn't find which 
> file(s) should be patched so that things work as I would expect.
>
> Does anyone have faced this problem as well?
> Kind regards,
>
> Rômulo
> -- 
> Rômulo PINHO
> Post-doc Research Engineer
> Centre Léon Bérard
> 28, rue Laennec 69373
> Lyon, France
> +33 (0)4 78 78 51 50
> romulo.pinho at lyon.unicancer.fr  
> http://www.creatis.insa-lyon.fr/rio/RomuloPinho
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121105/f6e6e001/attachment.htm>


More information about the Insight-users mailing list