<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-06-30 14:19 GMT+02:00 Ben Boeckel <span dir="ltr"><<a href="mailto:ben.boeckel@kitware.com" target="_blank">ben.boeckel@kitware.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mon, Jun 27, 2016 at 21:44:14 +0200, Elvis Stansvik wrote:<br>
> 1. The shear amount of libraries that are linked against. Are all these<br>
> really necessary, or is it possible to more selective somehow? Is there<br>
> something like Qt's CMake system, where you can pull in just a certain Qt<br>
> module with target_link_libraries(myapp Qt5::Widgets) ?<br>
<br>
</span>Use find_package(VTK REQUIRED COMPONENTS ${libraries_you_want}). Then<br>
link using ${vtkModuleName_LIBRARIES}. The way you are finding VTK gets<br>
all libraries.<br></blockquote><div><br></div><div>Ah yes, thanks.<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
You may also be interested in the VTK_ENABLE_KITS option which reduces<br>
the number of libraries VTK creates.<br></blockquote><div><br></div><div>Alright, I might look into that.<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> 2. How come the .so files are specified directly as inputs, with their full<br>
> paths? Isn't the common method to just add the appropriate -l (and possibly<br>
> -L if needed) flags?<br>
<br>
</span>CMake prefers full paths. The example is when you have this:<br>
<br>
    /path/A/libA.so<br>
    /path/A/libB.so<br>
    /path/B/libB.so<br>
<br>
and you want to link /path/A/libA.so and /path/B/libB.so. Getting -L and<br>
-l right is finicky and hard to get right, so just using full paths is<br>
safer and easier. This usually occurs with setups where you want a newer<br>
version of A from Homebrew/Macports, but the system B where<br>
Homebrew/Macports just happens to also have a copy of B.<br></blockquote><div><br></div><div>Yep, I actually went to #cmake on Freenode asking about this and got a good explanation.<br><br></div><div>I thought that the names contained in ${VTK_LIBRARIES} et.c. were plain library names (which would result in -l / -L), but realize now that they are names of imported targets from VTK's installed CMake files, making cmake generate full paths.<br><br></div><div>Elvis<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
--Ben<br>
</font></span></blockquote></div><br></div></div>