[Insight-developers] Building ITK with Module_ITKVtkGlue forces client applications to find_package(VTK)?

Xiaoxiao Liu xiaoxiao.liu at kitware.com
Tue Jun 26 10:44:38 EDT 2012


It's the  Module_ITKVtkGlue that depends on VTK , not your own code.
You should be able to configure VTK_DIR when you enabled Module_ITKVtkGlue.
(Checkout "ITK/Modules/Bridge/VtkGlue/itk-module-init.cmake" ).



On Sat, Jun 23, 2012 at 11:57 AM, David Doria <daviddoria at gmail.com> wrote:

> If I build ITK in the default configuration, a simple program with
> CMakeLists.txt including:
>
> find_package(ITK REQUIRED)
> include(${ITK_USE_FILE})
>
> add_executable(TestITK TestITK.cpp)
> target_link_libraries(TestITK ${ITK_LIBRARIES})
>
> it works just fine. However, if I rebuild ITK with Module_ITKVtkGlue and
> then try to build the same project, I get lots of
>
> "cannot find -lvtkXYZ" linker errors.
>
> If I add:
>
> find_package(VTK REQUIRED)
> include(${VTK_USE_FILE})
>
> to my project CMakeLists.txt, it works again. Does this make sense? The
> source file that is getting compiled is simply:
>
> int main(int argc, char *argv[])
> {
>   return 0;
> }
>
> so it should not actually need to link to VTK. Shouldn't CMake be smart
> enough to realize that none of the VTK libraries that ITK was built with
> are needed in this project, so it should let the project build ok without
> referencing VTK at all?
>
> Thanks,
>
> David
>
> _______________________________________________
> 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.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-developers
>
>


-- 


---------------------------------------------
*Xiaoxiao Liu*, Ph.D.
R & D Engineer
Kitware Inc <http://www.kitware.com/>.
Clifton Park, NY
Phone: (518) 881-4924  or  (518) 371-3971 x124
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20120626/e67e5374/attachment.htm>


More information about the Insight-developers mailing list