I understand perfectly what you say, but it doesn&#39;t look like it&#39;s the currently implemented policy for retriggering find_library. Right now it looks like it all depends on the value of the cached variable. I have a somewhat similar use-case where I want to force find_package to look again for a package, but my current solution has to be triggered by the user (but we&#39;re OK with that).<br>
<br>Cheers<br><br><div class="gmail_quote">2009/4/30 Bill O&#39;Hara <span dir="ltr">&lt;<a href="mailto:billtohara@gmail.com">billtohara@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Apologies - meant to hit reply all.<div><div></div><div class="h5"><br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Bill O&#39;Hara</b> <span dir="ltr">&lt;<a href="mailto:billtohara@gmail.com" target="_blank">billtohara@gmail.com</a>&gt;</span><br>

Date: 2009/4/30<br>Subject: Re: [CMake] Location of library to be linked changing over time<br>To: Adolfo Rodríguez &lt;<a href="mailto:dofo79@gmail.com" target="_blank">dofo79@gmail.com</a>&gt;<br><br><br>Hi Adolfo,<br>
<br>Thanks for the suggestion. I understand that I can rerun cmake and have it find the new library version - perhaps even just a make rebuild_cache before each make test would work. <br>
<br>However, what I really would like to do is not have to do that *manually*. Our users have libraries in one of two places, &quot;a&quot; and &quot;b&quot;. If a library exists in &quot;a&quot; it should always be used even if we have previously linked against a version in &quot;b&quot;. So I need to find some way to track dependencies between a user of a library and the library, and trigger a relink if a new version of a library has appeared in one of those locations with &quot;a&quot; always winning if a library is in both places.<br>


<br>Let me rephrase the problem. I can add link_directories for &quot;a&quot; and &quot;b&quot; and have a build work by searching for libraries in those places at build time via -L flags to the compiler (not at cmake config time). But, that means cmake can&#39;t track dependencies because it doesn&#39;t know which file path we&#39;ll end up really linking with in the end. <br>


<br>Does that make sense?<br>Thanks<br>b.<br><br><br><div class="gmail_quote">2009/4/30 Adolfo Rodríguez <span dir="ltr">&lt;<a href="mailto:dofo79@gmail.com" target="_blank">dofo79@gmail.com</a>&gt;</span><div><div></div>

<div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Bill,<br><br>When you invoke find_library, FOO is created as a cache entry. As long as FOO has a value (i.e., not FOO_NOTFOUND) find_library will not refresh its contents on succesive runs of cmake. If you unset(FOO CACHE) and rerun cmake, then the foo library will be searched for again.<br>



Is this a good enough solution for your situation?<br><br>Regards,<br><br>Adolfo<br><br><div class="gmail_quote"><div><div></div><div>On Thu, Apr 30, 2009 at 9:55 PM, Bill O&#39;Hara <span dir="ltr">&lt;<a href="mailto:billtohara@gmail.com" target="_blank">billtohara@gmail.com</a>&gt;</span> wrote:<br>



</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div>Lets say I have a CMakeLists.txt that looks like this<br>
<br>find_library(FOO foo /tmp/a /tmp/b)<br>
add_executable(bar bar.c)<br>target_link_libraries(bar ${FOO})<br>add_test(test_bar bar)<br><br>then I run cmake, FOO is filled in with the located library from /tmp/b, and I run make all;make test. All is good. If I change /tmp/b/libfoo.a then when I run make test the executable is relinked before I execute it. All is good again.<br>




<br>Now lets say a newer copy of the library appears in /tmp/a. <br><br>When I run make test, what I&#39;d like to happen is that we notice it has appeared, and relink against it because we prefer to use /tmp/a/libfoo.a if it exists (hence the order in the find_library).<br>




<br>Is there a way to make that happen? I think if I wrote a raw makefile I could do this with vpaths or somesuch and still get the dependency checking ok. Is there a way with cmake?<br><br>Thanks<br><font color="#888888">b.<br>



<br>
</font><br></div></div>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br>Adolfo Rodríguez Tsouroukdissian<br>


<br>Robotics engineer<br>
PAL ROBOTICS S.L<br><a href="http://www.pal-robotics.com" target="_blank">http://www.pal-robotics.com</a><br>Tel. +34.93.414.53.47<br>Fax.+34.93.209.11.09<br>
</font></blockquote></div></div></div><br>
</div><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Adolfo Rodríguez Tsouroukdissian<br><br>Robotics engineer<br>PAL ROBOTICS S.L<br><a href="http://www.pal-robotics.com">http://www.pal-robotics.com</a><br>Tel. +34.93.414.53.47<br>
Fax.+34.93.209.11.09<br>