<div dir="ltr">Hi James,<div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 17, 2013 at 6:58 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">It doesn't seem to work.<div><br></div><div>I can't use target_link_libraries on an imported target.</div>
<div><br></div><div>add_library(imported_lib STATIC IMPORTED GLOBAL)</div><div>set_target_properties(imported_lib PROPERTIES IMPOARTED_LOCATION "${imported_lib_location}")</div></div></blockquote><div><br></div>
<div>Is this typo in the property name only in the mail or also in your cmake code? It should be IMPORTED_LOCATION of course.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>target_link_libraries(imported_lib other_lib)</div><div><br></div><div>Produces an error:</div><div><br></div><div>Attempt to add link library [imported_lib_location] to target imported_lib which is not built in this directory.</div>
</div></blockquote><div><br></div><div>Now, without having read all the history, this makes no sense to me. How should cmake link another library into your imported library? This would require re-linking that library, but cmake has no idea whats needed for that since it didn't build that imported library. If you're dealing with static libraries on ELF based systems this might be doable, because you can simply unback the .a archive and re-pack it including new object files or even simply add files to it. However other systems may use different types of static libraries that are not just a simple archive of object files, so this is really specific to a subset of the supported platforms. If you absolutely need that, then I'd write a post-link cmake script for 'other_lib' (assuming that one is built by cmake) that does the necessary steps.</div>
<div><br></div><div>Andreas</div></div></div></div>