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

David Doria daviddoria at gmail.com
Sat Jun 23 11:57:58 EDT 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20120623/1352de48/attachment.htm>


More information about the Insight-developers mailing list