If you want to use ITK with ITKVtkGlue, then your program will have to
also find VTK, in order to add VTK_LIBRARIES to the link list. Otherwise
the ITK libraries will have references to VTK that won't be satisfied.
It sounds like what you would like to happen is that the ITK will pull the
VTK dependency into your project; in other words, ITK_LIBRARIES will end
up also containing VTK_LIBRARIES, and ITK_INCLUDE_DIRS will also contain
VTK_INCLUDE_DIRS. But the ${ITK_USE_FILE} doesn't do that, and in
general, I don't think any package that CMake can find works that way.
--
Kent Williams [email protected]
On 6/23/12 10:57 AM, "David Doria" <[email protected]> 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
________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the
Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and
may be legally privileged. If you are not the intended recipient, you are
hereby notified that any retention, dissemination, distribution, or copying of
this communication is strictly prohibited. Please reply to the sender that you
have received the message in error, then delete it. Thank you.
________________________________
_______________________________________________
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