Ok.  JC's email showed how subdirectories can customize the value of the VTK_LIBRARIES and VTK_INCLUDE_DIRS variables within a subdirectory.  So, if my goal is to link against the minimum set of required vtk libraries, and support modular and non-modular vtk, then, here are two possibilities I can think of:<br>

<br><br># at the top level<br>find_package(VTK REQUIRED)<br><br><br># in a subdirectory<br>include(${VTK_USE_FILE})<br>if(is_modular)<br>  set(vtk_deps  vtkFiltersCore)<br>
else()<br>  set(vtk_deps vtkFiltering)<br>endif()<br><br>target_link_libraries(foo ${vtk_deps})<br><br><br>Or, maybe this is the more precise method:<br><br><br># in a subdirectory<br>find_package(VTK COMPONENTS vtkFiltersCore) #note, components argument is ignored for non-modular vtk<br>

include(${VTK_USE_FILE})<br><br>if(NOT is_modular)<br>  set(VTK_LIBRARIES vtkFiltering)<br>endif()<br><br>target_link_libraries(foo ${VTK_LIBRARIES})<br><br><br><br>Pat<br><br><br><div class="gmail_quote">
On Fri, Mar 30, 2012 at 10:40 PM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


And then use ITK_LIBRARIES.<br>
<div><div><br>
On Fri, Mar 30, 2012 at 4:57 PM, Jean-Christophe Fillion-Robin<br>
<<a href="mailto:jchris.fillionr@kitware.com" target="_blank">jchris.fillionr@kitware.com</a>> wrote:<br>
> Hi Pat,<br>
><br>
> Within ITK,  you could do the following [1]:<br>
><br>
>   MyProject<br>
>      |----- LibA   (depends on ITKFoo and ITKBar)<br>
>      |------LibB  (depends on ITKFoo)<br>
><br>
> Considering your project has two libraries and that these library have<br>
> different requirement regarding the ITK module they need, you could do:<br>
><br>
> In MyProject/LibA/CMakeLists.txt<br>
><br>
>    find_package(ITK COMPONENTS ITKFoo ITKBar)<br>
><br>
><br>
> In MyProject/LibB/CMakeLists.txt<br>
><br>
>    find_package(ITK COMPONENTS ITKFoo)<br>
><br>
> I believe the same should be possible within VTK modular.<br>
><br>
> What I wonder is where the name of components are described / listed.<br>
><br>
> Hth<br>
> Jc<br>
><br>
> [1]<br>
> <a href="http://wiki.slicer.org/slicerWiki/index.php/Documentation/Snapshot/Developers/Overlinking_Underlinking#Reply_from_Brad_King" target="_blank">http://wiki.slicer.org/slicerWiki/index.php/Documentation/Snapshot/Developers/Overlinking_Underlinking#Reply_from_Brad_King</a><br>



> [2] <a href="http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_package" target="_blank">http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_package</a><br>
><br>
><br>
> On Fri, Mar 30, 2012 at 7:40 PM, Pat Marion <<a href="mailto:pat.marion@kitware.com" target="_blank">pat.marion@kitware.com</a>> wrote:<br>
>><br>
>> I could be wrong, but I thought that using VTK_LIBRARIES would cause your<br>
>> project to link to all vtk libraries, when you may only want to link with<br>
>> specific ones, like vtkFiltering (or vtkFiltersCore for modularized.)<br>
>><br>
>> Also, is there is a cmake flag that can determine whether or not the vtk<br>
>> in use if modularized or not?  Perhaps just looking at the VTK version<br>
>> number?<br>
>><br>
>> Pat<br>
>><br>
>><br>
>> On Fri, Mar 30, 2012 at 7:28 PM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> I think if you use VTK_LIBRARIES in your target_link_libraries<br>
>>> everything should be OK. With ITK modular, applications use<br>
>>> ITK_LIBRARIES without problems for both ITKv3 and ITKv4.<br>
>>><br>
>>> On Fri, Mar 30, 2012 at 4:19 PM, Pat Marion <<a href="mailto:pat.marion@kitware.com" target="_blank">pat.marion@kitware.com</a>><br>
>>> wrote:<br>
>>> > Hi,<br>
>>> ><br>
>>> > It seems fairly straightforward to have a project support vtk 5 and vtk<br>
>>> > 6,<br>
>>> > but what about cmake code that can support both vtk and vtk modular?<br>
>>> > Any<br>
>>> > examples of what that might look like?<br>
>>> ><br>
>>> > The reason I ask is... PCL uses VTK on the desktop, but what if I want<br>
>>> > to<br>
>>> > use VTK+VES  for PCL on mobile.  Then the PCL cmake system should know<br>
>>> > how<br>
>>> > to use vtk modular, since VES uses vtk modular.<br>
>>> ><br>
>>> > Pat<br>
>>> ><br>
>>> > _______________________________________________<br>
>>> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>>> ><br>
>>> > Visit other Kitware open-source projects at<br>
>>> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>>> ><br>
>>> > Follow this link to subscribe/unsubscribe:<br>
>>> > <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
>>> ><br>
>>> ><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Unpaid intern in BillsBasement at noware dot com<br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
>><br>
>><br>
><br>
><br>
><br>
> --<br>
> <a href="tel:%2B1%20919%20869%208849" value="+19198698849" target="_blank">+1 919 869 8849</a><br>
><br>
<br>
<br>
<br>
--<br>
Unpaid intern in BillsBasement at noware dot com<br>
</div></div></blockquote></div><br>