[CMake] capturing dependency on external library

Alexander Neundorf a.neundorf-work at gmx.net
Sat Dec 2 18:31:49 EST 2006


-------- Original-Nachricht --------
Datum: Sat, 2 Dec 2006 12:19:40 +0100
Von: "Crni Gorac" <cgorac at gmail.com>
An: cmake at cmake.org
Betreff: [CMake] capturing dependency on external library

> We have a rather large project consisting of number of libraries and
> executables.  The development is split between multiple developers, and
> we have an arrangement to actually have "make install" applied to
> libraries, so that we don't have to put each library's source/build
> directory into given executable project CMakeLists.txt file trough
> INCLUDE_DIRECTORIES() and LINK_DIRECTORIES() commands.  

Is this all in one cmake project ?
Then you don't need LINK_DIRECTORIES().
If you have 
add_library(myfoolib ... )
in some directory
and
add_executable(myapp ...)
target_link_libraries(myapp myfoolib)

in some other directory cmake will have all the right dependencies and link to the correct library. You only have to care for the include dirs.

> Also, libraries
> have to be built as static, and the problem we are encountering is that
> after doing "make install" for a new build of given library and getting
> back to executable depending on this library and trying "make", it is
> not recognized that library has changed and executable is not rebuilt.
> So what we need is practically for executable "foo" and library
> "libbar.a" to have following rule added to makefile:
> foo: /some/path/to/libbar.a

That's the installed library, right ?
I'm not sure it's a good idea, but maybe you can do something with a helper target, add_custom_target() and the DEPENDS option of it.
But actually I think you shouldn't do that.

Bye
Alex

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer


More information about the CMake mailing list