From: Peter Vanroose <peter_vanroose@ya...> - 2009-06-18 16:22:46
The explanation of what you see happening is fairly simple, and will show that this is certainly not a dependency of vnl on rrel:
The class vnl_real_eigensystem belongs to the library vnl_algo, not vnl.
So, when a program has the following two lines:
it is to be expected that, after compilation, it needs to link to at least both vnl and vnl_algo (and nothing else, normally).
If your system has "auto" dynamic linking (and apparently it does), and because lib rrel depends on (vnl_algo, vnl, vgl), by linking your program to just rrel (even not vnl) it will work -- actually you link to two unnecessary libraries as well: rrel and vgl.
So it's not the addition of rrel which made it working, but the implicit addition of vnl_algo.
In all CMakeLists.txt files we try to explicitly mention all direct dependencies (in TARGET_LINK_LIBRARIES), even if a shorter list would also have worked because of this automatic dependency linking.
Your example is a nice one to explain why this is a good habit:
- suppose I have a program using rrel, vnl, and vnl_algo
- I just link to rrel, because the rest is automatic.
- then I remove the dependency on rrel, and also the linking;
now the program does not link (or run) anymore
- this "unexpected behaviour" is avoided by explicitly linking th rrel, vnl and vnl_algo from the beginning (but not to e.g. netlib, which is an indirect dependency og vnl_algo). Removing now both the #include <rrel....> and the TARGET_LINK_LIBRARIES(rrel) keeps the whole thing working.
Hope that explained it clear enough... sorry for my cripple English...
Sök efter kärleken!
Hitta din tvillingsjäl på Yahoo! Dejting: http://ad.doubleclick.net/clk;185753627;24584539;x?http://se.meetic.yahoo.net/index.php?mtcmk=148783