I have a project set up that imports libraries, and I want to relink if those 
imported libraries change;

For example, in a directory I have
hellow.c
libfred.a
CMakeLists.txt

where CMakeLists.txt contains:
-----------------------------------------
LINK_DIRECTORIES(.)
ADD_EXECUTABLE(hellow hellow.c)
TARGET_LINK_LIBRARIES(hellow fred)
-----------------------------------------
I run 'cmake .'

Now if I touch hellow.c, hellow rebuilds, but if I touch libfred.a then hellow 
doesn't rebuild.

I've tried every method I can think of to add a dependency from the executable 
on the library, but I can't work out how to do it.

One trick that I have found, which is unsatisfying in many ways, is:
-------------------------------------------
INCLUDE(AddFileDependencies)
LINK_DIRECTORIES(.)
ADD_EXECUTABLE(hellow hellow.c)
ADD_FILE_DEPENDENCIES(hellow.c libfred.a)
TARGET_LINK_LIBRARIES(hellow fred)
--------------------------------------------

Can anybody help?

Thanks,
Lezz Giles
Soapstone Networks

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to