On Wed, Apr 1, 2009 at 5:35 PM, Marcel Loose <span dir="ltr"><<a href="mailto:loose@astron.nl">loose@astron.nl</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br>
<br>
I was wondering why the link_libraries() command has been deprecated. Commands like include_directories() and link_directories() which have the same "scope" have not been deprecated. I think that link_libraries() has its virtues too.<br>
<br>
My reason for asking this, is that I wonder what's the proper way to add a library to *all* targets in a project; for example, a logging library or a threads library. Here, link_libraries() provides IMHO a much cleaner solution, than target_link_libraries(). The latter requires me to keep track of the globally used library in a variable that must be passed around; and for each target I must explicitly specify its dependency on this library by using target_link_libraries().<br>
<br>
Or, am I missing something, and is there a cleaner way to do this, without using a deprecated feature?</blockquote><div><br>Often I have seen people write functions to help with this especially if you have more than one common library.<br>
<br>function(link_target_against_common_libs _target)<br> target_link_libraries(${_target} ${WHATEVER_LIBRARY})<br>endfunction()<br><br>Another approach is if you have a low level library as part of your codebase that everyone depends upon you can simply make it dependent on your threading or logging libraries and anyone that is dependent against it will automatically link against the threading or logging library.<br>
</div></div><br>-- <br>Philip Lowman<br>