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'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>b.<br><br>