<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 3, 2013 at 9:12 AM, J Decker <span dir="ltr">&lt;<a href="mailto:d3ck0r@gmail.com" target="_blank">d3ck0r@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>alternate target_link_libraries.  Usage is the same.  Test if each library to link is a target, get that targets path, and break it into parts and add it to LINK_FLAGS else add with target_link_libraries...</div>

<div><br></div><div>macro(my_target_link_libraries target )</div><div>    if(CMAKE_COMPILER_IS_GNUCC)</div><div>       foreach( target_lib ${ARGN} )</div><div>          if( TARGET ${target_lib} )</div><div>             get_property( lib_path TARGET ${target_lib} PROPERTY LOCATION)</div>

<div>             if( ${lib_path} MATCHES &quot;(.*)/([^/]*)$&quot; )</div><div>                get_target_property(existing_link_flags ${target} LINK_FLAGS)</div><div></div></div></blockquote><div><br></div><div style>#  Revision to handle OUTPUT_NAME overridden targets.</div>
<div><div>             get_property( existing_outname TARGET ${target_lib} PROPERTY OUTPUT_NAME )</div><div>             if( NOT existing_outname )</div><div><span class="" style="white-space:pre">        </span>             set( existing_outname ${target_lib} )</div>
<div>             endif( NOT existing_outname )</div></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div>                if(existing_link_flags)</div><div>+                    set(new_link_flags &quot;${existing_link_flags} -L ${CMAKE_MATCH_1} -l ${existing_outname }&quot;)</div>
<div>                else()</div><div>+                    set(new_link_flags &quot;-L ${CMAKE_MATCH_1} -l ${existing_outname}&quot;)</div><div>                endif()</div><div>                set_target_properties( ${target} PROPERTIES LINK_FLAGS ${new_link_flags})</div>

<div>             endif( ${lib_path} MATCHES &quot;(.*)/([^/]*)$&quot; )</div><div>          else()</div><div>             target_link_libraries( ${target} ${target_lib} )</div><div>          endif( TARGET ${target_lib} )</div>

<div>       endforeach( target_lib ${ARGN} )</div><div>    else()</div><div>    <span style="white-space:pre-wrap">        </span>target_link_libraries( ${target} ${ARGN} )</div><div>    endif()</div><div>endmacro()</div><div>
<br></div></div>
</blockquote></div><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">macro(my_target_link_libraries target )</div><div class="gmail_extra">    if(CMAKE_COMPILER_IS_GNUCC)</div>
<div class="gmail_extra">       foreach( target_lib ${ARGN} )</div><div class="gmail_extra">          if( TARGET ${target_lib} )</div><div class="gmail_extra">             get_property( lib_path TARGET ${target_lib} PROPERTY LOCATION)</div>
<div class="gmail_extra">             get_property( existing_outname TARGET ${target_lib} PROPERTY OUTPUT_NAME )</div><div class="gmail_extra">             if( NOT existing_outname )</div><div class="gmail_extra"><span class="" style="white-space:pre">        </span>             set( existing_outname ${target_lib} )</div>
<div class="gmail_extra">             endif( NOT existing_outname )</div><div class="gmail_extra">             if( ${lib_path} MATCHES &quot;(.*)/([^/]*)$&quot; )</div><div class="gmail_extra">                get_target_property(existing_link_flags ${target} LINK_FLAGS)</div>
<div class="gmail_extra">                if(existing_link_flags)</div><div class="gmail_extra">                </div><div class="gmail_extra">                    set(new_link_flags &quot;${existing_link_flags} -L ${CMAKE_MATCH_1} -l ${existing_outname}&quot;)</div>
<div class="gmail_extra">                else()</div><div class="gmail_extra">                    set(new_link_flags &quot;-L ${CMAKE_MATCH_1} -l ${existing_outname}&quot;)</div><div class="gmail_extra">                endif()</div>
<div class="gmail_extra">                set_target_properties( ${target} PROPERTIES LINK_FLAGS ${new_link_flags})</div><div class="gmail_extra">             endif( ${lib_path} MATCHES &quot;(.*)/([^/]*)$&quot; )</div><div class="gmail_extra">
          else()</div><div class="gmail_extra">             target_link_libraries( ${target} ${target_lib} )</div><div class="gmail_extra">          endif( TARGET ${target_lib} )</div><div class="gmail_extra">       endforeach( target_lib ${ARGN} )</div>
<div class="gmail_extra">    else()</div><div class="gmail_extra">    <span class="" style="white-space:pre">        </span>target_link_libraries( ${target} ${ARGN} )</div><div class="gmail_extra">    endif()</div><div class="gmail_extra">
endmacro()</div><div><br></div></div></div>