[CMake] Dependency build order problem

Alexander Neundorf a.neundorf-work at gmx.net
Sat Jan 5 08:28:23 EST 2008


On Saturday 05 January 2008, Trevor Kellaway wrote:
> Alex,
>
> Wow, that must probably be a record for fastest response to a post (3
> minutes)!

You're welcome :-)

> > I think you have to use
> > add_dependencies(d e)
> >
> > to tell cmake that d depends on e (which it does since it
> > needs something from the build of e)
>
> That has fixed it, by changing d's CMakeLists.txt to the following:
>
>  SET (THIS_LIB d)
>  SET (THIS_SRC d.c)
>
>  ADD_LIBRARY (${THIS_LIB} ${THIS_SRC})
>
>  ADD_DEPENDENCIES (d e)
>
>
> Note: I tried placing the ADD_DEPENDENCIES in the top level CMakeLists
> at various positions but this didn't work.

You have to put it in the directory where the target is created (using 
add_library()).

Alex


More information about the CMake mailing list