[CMake] Location of library to be linked changing over time

Bill O'Hara billtohara at gmail.com
Thu Apr 30 15:55:20 EDT 2009


Lets say I have a CMakeLists.txt that looks like this

find_library(FOO foo /tmp/a /tmp/b)
add_executable(bar bar.c)
target_link_libraries(bar ${FOO})
add_test(test_bar bar)

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.

Now lets say a newer copy of the library appears in /tmp/a.

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).

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?

Thanks
b.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090430/94d2e6b9/attachment.htm>


More information about the CMake mailing list