[Insight-users] [Insight-developers] CMake config problem: ITK + GDCM 2 + VTK

Karthik Krishnan karthik.krishnan at kitware.com
Sun Jul 18 06:19:13 EDT 2010


Alternatively, the fix could also be made in ITK/VTK. After all
VTK-VERSION is used solely to decide if MetaIO is being compiled
within ITK or VTK. One could set the MetaIO-FOR-VTK / ITK from the
parent Utilities directory as well.

On 7/18/10, Stephen Aylward <stephen.aylward at kitware.com> wrote:
> Hi,
>
> I am far from a cmake expert, but it seems like those lines don't
> belong in the UseGDCM.cmake file.   They should be in the
> CMakeLists.txt file that is used to compile the library.  A
> UsePACKAGE.cmake file normally only sets the INCLUDE_DIRECTORIES and
> the LINK_DIRECTORIES for that specific package.
>
> I'm basing my conclusion on looking at the UseCTK.cmake and
> UseVTK.cmake files.  They never issue FIND commands from within them,
> they do not output paths to Qt or other libraries that they may have
> used, and they seem to only export the above listed directory
> variable...although UseITK.cmake does also export some additional
> variables if a system gdcm or a system vxl is used - but only specific
> vars are exported in those cases, and I'm not certain why those
> exports are needed.
>
> Karthik/Luis/others - do you agree, or am I mistaken/wrong/full-of-%@$#! :)
>
> Thanks,
> s
>
> On Sat, Jul 17, 2010 at 5:17 PM, Mathieu Malaterre
> <mathieu.malaterre at gmail.com> wrote:
>> Hi Stephen,
>>
>>  Here is how the cmake/gdcm config/use file is setup:
>>
>>
>> $ cat /usr/lib/gdcm-2.0/UseGDCM.cmake
>> ...
>>  # Use VTK.
>>  IF(GDCM_USE_VTK)
>>    SET(VTK_DIR ${GDCM_VTK_DIR})
>>    FIND_PACKAGE(VTK)
>>    IF(VTK_FOUND)
>>      INCLUDE(${VTK_USE_FILE})
>>    ELSE(VTK_FOUND)
>>      MESSAGE("VTK not found in GDCM_VTK_DIR=\"${GDCM_VTK_DIR}\".")
>>    ENDIF(VTK_FOUND)
>>  ENDIF(GDCM_USE_VTK)
>> ...
>>
>>  This setting is required since vtkgdcm class derives from vtk
>> classes. This means compilation would fails if the VTK header would
>> not be found. Therefore I believe this is a requirement for vtkgdcm
>> module to pull in vtk cmake setting.
>>
>>  Could you please recommend another way for doing this ?
>>
>> Thanks for your comments !
>> -Mathieu
>>
>> On Sat, Jul 17, 2010 at 7:16 PM, Stephen Aylward
>> <stephen.aylward at kitware.com> wrote:
>>> Yeah - that's probably it.
>>>
>>> I could add a AND NOT GDCM_USE_VTK to the VTK_VERSION test in the
>>> MetaIO CMakeLists.txt file..ugly ugly ugly.
>>>
>>> I'd rather GDCM didn't export VTK's variables, but I guess it is
>>> necessary if the libraries it exports now depend on VTK.  However, if
>>> GDCM_USE_VTK only creates apps within GDCM 2 that depend on VTK, and
>>> its libraries never depend on VTK, then GDCM should be fixed.
>>>
>>> Other ideas?
>>>
>>> s
>>>
>>> On Sat, Jul 17, 2010 at 12:26 PM, Karthik Krishnan
>>> <karthik.krishnan at kitware.com> wrote:
>>>> I think the more likely place VTK-VERSION may be getting pulled in is
>>>> that GDCM has been built with the flag GDCM-USE-VTK set to ON. Dean
>>>> Inglis who initially reported the error on the attached link did have
>>>> this flag on.
>>>>
>>>> On 7/17/10, Stephen Aylward <stephen.aylward at kitware.com> wrote:
>>>>> The problem is that VTK_VERSION is being set somewhere that it
>>>>> shouldn't
>>>>>
>>>>> Bill H thinks VTK_VERSION might be set in GDCM.   Check the Cache/Use
>>>>> file on your local install.
>>>>>
>>>>> I checked the following in ITK:
>>>>>
>>>>> $ grep -R VTK_VERSION *
>>>>> Utilities/MetaIO/CMakeLists.txt:IF(VTK_VERSION)
>>>>> Utilities/MetaIO/CMakeLists.txt:ELSE(VTK_VERSION)
>>>>> Utilities/MetaIO/CMakeLists.txt:ENDIF(VTK_VERSION)
>>>>> Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/Wrapping/CMakeLists.txt:
>>>>> SET(VTK_VERSION
>>>>> "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}")
>>>>> Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/Wrapping/CMakeLists.txt:
>>>>> IF("${VTK_VERSION}" STRLESS "${MIN_ITK_VER}")
>>>>> Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/Wrapping/CMakeLists.txt:
>>>>> ELSE("${VTK_VERSION}" STRLESS "${MIN_ITK_VER}")
>>>>> Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/Wrapping/CMakeLists.txt:
>>>>> ENDIF("${VTK_VERSION}" STRLESS "${MIN_ITK_VER}")
>>>>>
>>>>> So, if WrapITK is being used, then a temp var called VTK_VERSION is
>>>>> being created...which is kind of a "reserved" CMake variable and could
>>>>> cause the error.  Is wrapping enabled?
>>>>>
>>>>> s
>>>>>
>>>>> On Sat, Jul 17, 2010 at 10:35 AM, Bill Lorensen
>>>>> <bill.lorensen at gmail.com>
>>>>> wrote:
>>>>>> Hmmm... that happened to me too.
>>>>>>
>>>>>> Why haven't we fixed this?
>>>>>>
>>>>>> Bill
>>>>>>
>>>>>> On Sat, Jul 17, 2010 at 8:47 AM, Karthik Krishnan
>>>>>> <karthik.krishnan at kitware.com> wrote:
>>>>>>> Known issue.. See this
>>>>>>>
>>>>>>>   http://www.itk.org/pipermail/insight-users/2010-June/037360.html
>>>>>>>
>>>>>>> and
>>>>>>>
>>>>>>>   http://www.itk.org/pipermail/insight-users/2010-July/037404.html
>>>>>>>
>>>>>>> I think the consensus is to downgrade to CMake 2.6 from Cmake 2.8
>>>>>>>
>>>>>>>
>>>>>>> On Sat, Jul 17, 2010 at 3:25 PM, Roger Bramon Feixas
>>>>>>> <rogerbramon at gmail.com>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>> I have the same problem reported in this
>>>>>>>> thread: http://www.itk.org/pipermail/insight-users/2010-March/035903.html,
>>>>>>>> but any solution was published. I would like to continue the
>>>>>>>> discussion.
>>>>>>>> I'm trying to compile ITK 3.18 with GDCM 2.0.15. I compiled
>>>>>>>> correctly
>>>>>>>> GDCM
>>>>>>>> 2.0.15 with VTK 5.6 but when I set to 1 the ITK_USE_SYSTEM_GDCM
>>>>>>>> option
>>>>>>>> this
>>>>>>>> CMake message error appears:
>>>>>>>> CMake Error at Utilities/MetaIO/CMakeLists.txt:104 (INSTALL):
>>>>>>>>   install TARGETS given no LIBRARY DESTINATION for shared library
>>>>>>>> target
>>>>>>>>   "vtkmetaio".
>>>>>>>>
>>>>>>>> In the mentioned thread, Brad King proposed a test:
>>>>>>>> "
>>>>>>>> Edit ITK/Utilities/MetaIO/CMakeLists.txt to add some message()-s
>>>>>>>> in this top block:
>>>>>>>> IF(VTK_VERSION)
>>>>>>>>   SET(METAIO_FOR_VTK 1)
>>>>>>>>   MARK_AS_ADVANCED( METAIO_FOR_VTK )
>>>>>>>>   SET(METAIO_NAMESPACE "vtkmetaio")
>>>>>>>>   MESSAGE(FATAL_ERRORO "ITK IS NOT VTK!")  # ADD THIS LINE
>>>>>>>> ELSE(VTK_VERSION)
>>>>>>>> ...
>>>>>>>> ENDIF(VTK_VERSION)
>>>>>>>> Does CMake hit this?  Are you pointing ITK at a VTK? "
>>>>>>>> I tested it, and yes, CMake hits this.
>>>>>>>> Anyone have any suggestion?
>>>>>>>> Thanks,
>>>>>>>> Roger
>>>>>>>> _____________________________________
>>>>>>>> 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.html
>>>>>>>>
>>>>>>>> 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
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _____________________________________
>>>>>>> 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.html
>>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>> _______________________________________________
>>>>>> 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://kitware.com/products/protraining.html
>>>>>>
>>>>>> 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-developers
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> ==============================
>>>>> Stephen R. Aylward, Ph.D.
>>>>> Director of Medical Imaging Research
>>>>> Kitware, Inc. - North Carolina Office
>>>>> http://www.kitware.com
>>>>> stephen.aylward (Skype)
>>>>> (919) 969-6990 x300
>>>>>
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> ==============================
>>> Stephen R. Aylward, Ph.D.
>>> Director of Medical Imaging Research
>>> Kitware, Inc. - North Carolina Office
>>> http://www.kitware.com
>>> stephen.aylward (Skype)
>>> (919) 969-6990 x300
>>> _______________________________________________
>>> 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://kitware.com/products/protraining.html
>>>
>>> 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-developers
>>>
>>
>>
>>
>> --
>> Mathieu
>>
>
>
>
> --
>
> ==============================
> Stephen R. Aylward, Ph.D.
> Director of Medical Imaging Research
> Kitware, Inc. - North Carolina Office
> http://www.kitware.com
> stephen.aylward (Skype)
> (919) 969-6990 x300
>


More information about the Insight-users mailing list