<div dir="ltr">I made a reproducer and discovered a couple of interesting things. If the dependent library is static then IMPORATED_LINK_DEPENDENT_LIBRARIES doesn't work for 2.8.4+. If I instead change it to IMPORTED_LINK_INTERFACE_LIBRARIES then it works correctly regardless of if the dependent library is static or shared and works for 2.8.4+.<div>
<br></div><div style>I'm not sure what the expected behavior is supposed to be, but I attached my simple reproducer.</div><div style><br></div><div style> </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, Mar 13, 2013 at 5:08 PM, James Bigler <span dir="ltr"><<a href="mailto:jamesbigler@gmail.com" target="_blank">jamesbigler@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">I determined that this failed starting in 2.8.7 (2.8.6 has the cudart library on the link line, and 2.8.7 didn't). I didn't see anything particular about changes to the IMPORT libraries to suggest why this might have happened. I'll try and rig up a reproducer.<div>
<br></div><div>I did notice that there wasn't a test for <span style="font-size:13px;font-family:'courier new',monospace">IMPORTED_LINK_DEPENDENT_</span><span style="font-size:13px;font-family:'courier new',monospace">LIBRARIES</span> aside from trying to create a circular dependency between a single library. </div>
</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Mar 13, 2013 at 4:35 PM, James Bigler <span dir="ltr"><<a href="mailto:jamesbigler@gmail.com" target="_blank">jamesbigler@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I used the following code in 2.8.4, but in 2.8.9 and 2.8.10 it doesn't add the CUDA_CUDART_LIBRARY library to the eventual link line. I see my target linking against the parallelprim library but not the cudart library. Did something change in the interface between 2.8.4 and now?<div>
<br></div><div>I'll continue to try and narrow down the version of CMake where this stopped working.</div><div><br></div><div><div><font face="courier new, monospace"> # Create an imported static target</font></div>
<div><font face="courier new, monospace"> add_library(parallelprim STATIC IMPORTED)</font></div><div><font face="courier new, monospace"> # This library pertains to all configurations</font></div><div><font face="courier new, monospace"> set_property(TARGET parallelprim APPEND PROPERTY IMPORTED_CONFIGURATIONS NOCONFIG)</font></div>
<div><font face="courier new, monospace"> # Set the location</font></div><div><font face="courier new, monospace"> set_target_properties(parallelprim PROPERTIES</font></div><div><font face="courier new, monospace"> IMPORTED_LOCATION_NOCONFIG "${PARALLELPRIM_LIBRARY}")</font></div>
<div><font face="courier new, monospace"> # Set list of dependent libraries (parallelprim needs cudart)</font></div><div><span style="font-family:'courier new',monospace"> set_target_properties(parallelprim PROPERTIES</span><br>
</div><div><font face="courier new, monospace"> IMPORTED_LINK_DEPENDENT_LIBRARIES ${CUDA_CUDART_LIBRARY})</font></div><div><br></div><div>I also tried this and it didn't work:</div><div><br></div><div>
<div><font face="courier new, monospace"> # Create an imported static target</font></div><div><font face="courier new, monospace"> add_library(parallelprim STATIC IMPORTED)</font></div><div><font face="courier new, monospace"> # Set the location<br>
</font></div><div><font face="courier new, monospace"> set_target_properties(parallelprim PROPERTIES</font></div><div><font face="courier new, monospace"> IMPORTED_LOCATION "${PARALLELPRIM_LIBRARY}")</font></div>
<div><font face="courier new, monospace"> # Set list of dependent libraries (parallelprim needs cudart)</font></div><div><font face="courier new, monospace"> set_target_properties(parallelprim PROPERTIES<br></font></div>
<div><font face="courier new, monospace"> IMPORTED_LINK_DEPENDENT_LIBRARIES ${CUDA_CUDART_LIBRARY})</font></div><div><br></div><div>Thanks,</div><div>James</div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>