<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-06-27 22:10 GMT+02:00 David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Mon, Jun 27, 2016 at 1:44 PM, Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><span class=""><div><div><div>I'm using the trio<br><br>find_package(VTK REQUIRED)<br><br>include(${VTK_USE_FILE})<br><br>target_link_libraries(myapp ${VTK_LIBRARIES})<br><br></div>in my CMakeLists.txt, to find and link against VTK, like is done in the VTK examples.<br></div><br></div></span><span class="">I'm surprised by two things:<br><br></span></div><span class="">1. The shear amount of libraries that are linked against. Are all these really necessary, or is it possible to more selective somehow? Is there something like Qt's CMake system, where you can pull in just a certain Qt module with target_link_libraries(myapp Qt5::Widgets) ?<br><br></span></div><span class="">2. How come the .so files are specified directly as inputs, with their full paths? Isn't the common method to just add the appropriate -l (and possibly -L if needed) flags?<br></span></div></div></div></blockquote><div><br></div><div>I build my own list that contains only the libraries that I need, and I also try to be careful about public vs. private linkage.  For example:</div><div><br></div><div><div>    set(VTK_LIBS vtkCommonCore vtkCommonDataModel vtkImagingCore vtkIOImage)</div><div>    # Also link vtkIOMPIImage if present, it has factories for vtkIOImage</div><div>    list(FIND VTK_LIBRARIES vtkIOMPIImage TMP_INDEX)</div><div>    if(TMP_INDEX GREATER -1)</div><div>      set(VTK_LIBS ${VTK_LIBS} vtkIOMPIImage)</div><div>    endif()</div></div><div><br></div><div><div>    target_link_libraries(${LIB_NAME} LINK_PUBLIC ${VTK_LIBS})</div><div>    # target_link_libraries(${LIB_NAME} LINK_PRIVATE <other libs>)</div></div><div><br></div><div>To find out what modules you need to link, the script VTK/Utilities/Maintenance/WhatModulesVTK.py can be of some use.</div></div></div></div></blockquote><div><br></div><div>The script seems to work fine, but has some limitations. It seems it only considers headers that start with "vtk", so if I include QVTKWidget.h, it won't pick up that I need the vtkGUISupportQt module.<br><br></div><div>Elvis<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">







<div><br></div><div>I know this doesn't cover all of your points, but unfortunately this is as complete an answer as I have time to give right now.  Hopefully someone else can jump in and provide more details.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div> - David</div><div><br></div></font></span></div></div></div>
</blockquote></div><br></div></div>