Have I gone and confused everybody on this? :P<br clear="all"><div><br></div><div>---------</div>Robert Dailey<br>
<br><br><div class="gmail_quote">On Mon, Jan 23, 2012 at 6:01 PM, Robert Dailey <span dir="ltr">&lt;<a href="mailto:rcdailey@gmail.com">rcdailey@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
As you know, in target_link_libraries(), you can specify &quot;debug&quot;, &quot;optimized&quot;, or &quot;general&quot; to specify which configurations a library will be applied to.<div><br></div><div>I have developed a system to allow dependencies to recursively add their own dependencies. Suppose we have 3 targets:</div>


<div><br></div><div>A:</div><div>  libx</div><div>  liby</div><div>  libz</div><div><br></div><div>B:</div><div>  foo</div><div>  bar</div><div>  A</div><div><br></div><div>C:</div><div>  A</div><div>  B</div>
<div><br></div><div><br></div><div>Above, I list each target (A, B, C). The items under it are the targets it depends on. So, target A depends on targets named libx, liby, and libz. Similarly, target B depends on targets foo, bar, and A.</div>

<div><br></div><div>When I flatten out all of the dependencies for target C, it looks like so:</div><div><br></div><div>A</div><div>B</div><div>libx</div><div>liby</div><div>libz</div><div>foo</div><div>bar</div><div><br>

</div><div>This is pretty simple, but each dependency listed can also have a &quot;debug&quot;, &quot;release&quot;, or &quot;general&quot; next to it. So let&#39;s use the same example as last time, but introduce some of these prefixes:</div>

<div><div><br>A:</div><div>  libx</div><div>  liby</div><div>  libz</div><div><br></div><div>B:</div><div>  foo</div><div>  bar</div><div>  A</div><div><br></div><div>C:</div><div>  debug B</div>
</div><div><br></div><div>Above, since &quot;B&quot; is listed as &quot;debug&quot;, library B and all of its dependencies should only build in the debug configuration. So when we flatten this out, you will see the following. Note that this flattened list is what is sent to target_link_libraries()</div>

<div><br></div><div>debug B</div><div>debug foo</div><div>debug bar</div><div>debug A</div><div>debug libx</div><div>debug liby</div><div>debug libz</div><div><br></div><div>Now where this REALLY gets confusing, is when we have a mixture of &quot;conflicts&quot;, where the same target is specified as a dependency twice, but with different configuration prefixes:</div>

<div><br></div><div><div><br>A:</div><div>  libx</div><div>  liby</div><div>  libz</div><div><br></div><div>B:</div><div>  foo</div><div>  bar</div><div>  A</div><div><br></div><div>C:</div>
<div>  optimized A</div><div>  debug B</div><div><br></div><div>In this case, A&#39;s dependencies are specified as optimized, but B&#39;s are specified as debug, but B also depends on A, so A&#39;s dependencies would be debug as well.</div>

<div><br></div><div>I need to implement a system that can handle such conflicts and resolve them appropriately. For example, the way A&#39;s dependencies would be resolved is by specifying them as &quot;general&quot; or no prefix at all, since the flattened list includes them both in debug and optimized. So the final, flattened list would look like:</div>

<div><br></div><div>A</div><div>debug B</div><div>libx</div><div>liby</div><div>libz</div><div>debug foo</div><div>debug bar</div><div><br></div><div>This is VERY complex and due to the way lists work and stuff, I can&#39;t think of how to do this. Any tips?</div>

<div><br></div><div>---------</div><span class="HOEnZb"><font color="#888888">Robert Dailey<br>
</font></span></div>
</blockquote></div><br>