<div>On Thu, May 17, 2012 at 2:18 AM, Petr Kmoch <span dir="ltr"><<a href="mailto:petr.kmoch@gmail.com" target="_blank">petr.kmoch@gmail.com</a>></span> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi David,<br>
<br>
there's a target property LINK_INTERFACE_LIBRARIES (and<br>
per-configuration variants) which can be used for this purpose.<br>
Starting with 2.8.7, target_link_libraries() also accepts<br>
LINK_INTERFACE_LIBRARIES as a new argument mode, setting the property<br>
instead of linking.<br>
<br>
Petr</blockquote><div><br></div><div>Petr,</div><div><br></div><div>I tried the following, but in both cases (target_link_libraries and set_target_properties) I still get a linker error that it can't find TestB().</div>
<div><br></div><div>cmake_minimum_required(VERSION 2.6)</div><div>PROJECT(Test)</div><div><br></div><div>add_library(TestB TestB.cpp)</div><div><br></div><div># TestA depends on TestB</div><div>add_library(TestA TestA.cpp)</div>
<div>#target_link_libraries(TestA LINK_INTERFACE_LIBRARIES TestB)</div><div>set_target_properties(TestA PROPERTIES LINK_INTERFACE_LIBRARIES "TestB")</div><div><br></div><div># I want to link to TestA and have it automatically also link to TestB</div>
<div>add_executable(Test Test.cpp)</div><div>target_link_libraries(Test TestA)</div><div><br></div><div>I have uploaded the entire demo project here:</div><div><a href="http://homepages.rpi.edu/~doriad/Upload/TestCMake.tar.gz">http://homepages.rpi.edu/~doriad/Upload/TestCMake.tar.gz</a></div>
<div><br></div><div>Any ideas?</div><div><br></div><div>Thanks,</div><div><br></div>David<br><div> </div></div>