On Thu, Jan 7, 2010 at 4:00 PM, Jed Brown <span dir="ltr">&lt;<a href="mailto:jed@59a2.org">jed@59a2.org</a>&gt;</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;">
<div class="im">On Thu, 07 Jan 2010 15:54:33 -0600, Ryan Pavlik &lt;<a href="mailto:rpavlik@iastate.edu">rpavlik@iastate.edu</a>&gt; wrote:<br>
&gt; If you use the _LIBRARIES variable, you don&#39;t need to even mess around<br>
&gt; with the imported targets thing<br>
<br>
</div>Dumping recursive dependencies in *_LIBRARIES causes overlinking, they<br>
should only be there when linking statically.<br>
<font color="#888888"><br>
Jed<br>
</font></blockquote></div><br>So then actually should we all be doing imported targets in our find modules then?  I didn&#39;t realize it: most of the ones I looked at that come with cmake didn&#39;t use it, so I just worked around it - wrote a function that can safely remove those dupes instead :)<br>
<br>Is there any drawback (besides slightly longer code) to doing the imported targets route?<br><br>Here&#39;s that CleanLibraryList.cmake file:<br><br><br># - A smarter replacement for list(REMOVE_DUPLICATES) for library lists<br>
#<br>#  clean_library_list(&lt;listvar&gt; [&lt;additional list items&gt;...]) - where<br>#  WHATEVER_LIBRARIES is the name of a variable, such as a variable being<br>#  created in a Find script.<br>#<br># Removes duplicates from the list then sorts while preserving &quot;optimized&quot;,<br>
# &quot;debug&quot;, and &quot;general&quot; labeling<br>#<br># Requires CMake 2.6 or newer (uses the &#39;function&#39; command)<br>#<br># Original Author:<br># 2009-2010 Ryan Pavlik &lt;<a href="mailto:rpavlik@iastate.edu">rpavlik@iastate.edu</a>&gt; &lt;<a href="mailto:abiryan@ryand.net">abiryan@ryand.net</a>&gt;<br>
# <a href="http://academic.cleardefinition.com">http://academic.cleardefinition.com</a><br># Iowa State University HCI Graduate Program/VRAC<br><br>function(clean_library_list _var)<br>    # combine variable&#39;s current value with additional list items<br>
    set(_work ${${_var}} ${ARGN})<br>    if(_work)<br>        # Turn each of optimized, debug, and general into flags<br>        # prefixed on their respective library (combining list items)<br>        string(REGEX REPLACE &quot;optimized;&quot; &quot;1CLL%O%&quot; _work &quot;${_work}&quot;)<br>
        string(REGEX REPLACE &quot;debug;&quot; &quot;1CLL%D%&quot; _work &quot;${_work}&quot;)<br>        string(REGEX REPLACE &quot;general;&quot; &quot;1CLL%G%&quot; _work &quot;${_work}&quot;)<br><br>        # clean up list<br>
        list(REMOVE_DUPLICATES _work)<br>        list(SORT _work)<br><br>        # Split list items back out again: turn prefixes into the<br>        # library type flags.<br>        string(REGEX REPLACE &quot;1CLL%G%&quot; &quot;general;&quot; _work &quot;${_work}&quot;)<br>
        string(REGEX REPLACE &quot;1CLL%D%&quot; &quot;debug;&quot; _work &quot;${_work}&quot;)<br>        string(REGEX REPLACE &quot;1CLL%O%&quot; &quot;optimized;&quot; _work &quot;${_work}&quot;)<br><br>        # Return _work<br>
        set(${_var} ${_work} PARENT_SCOPE)<br>    endif()<br>endfunction()<br><br clear="all"><br>-- <br>Ryan Pavlik<br>HCI Graduate Student<br>Virtual Reality Applications Center<br>Iowa State University<br><br><a href="mailto:rpavlik@iastate.edu">rpavlik@iastate.edu</a><br>
<a href="http://academic.cleardefinition.com">http://academic.cleardefinition.com</a><br>Internal VRAC/HCI Site: <a href="http://tinyurl.com/rpavlik">http://tinyurl.com/rpavlik</a><br>