[CMake] Generated source files and dependencies(+) (Wojciech Migda)

Wojciech Migda wojtek.golf at interia.pl
Wed Sep 9 04:25:08 EDT 2009


Użytkownik "Clinton Stimpson"  napisał(a): 
> From: "Clinton Stimpson" 
> Subject: Re: [CMake] Generated source files and dependencies(+)
(Wojciech Migda)
> To: cmake at cmake.org
> 
> On Tuesday 08 September 2009 02:14:45 pm Wojciech Migda wrote:
> > > Why not include it in the foo target, instead of making a new
> >
> > a_h_gen target and doing extra dependencies manually?
> >
> > Firstly, we have hundred of source files which may indirectly depend
> > generated source files, so we want such information to be covered by
> > cmake dependency scanner itself - the problem is that there is no
link
> > between the library target and the header target.
> 
> That's why I suggested
> ADD_LIBRARY(foo STATIC a.c ${CMAKE_CURRENT_BINARY_DIR}/a.h)
> 
> It creates the generated headers for foo, then does the dependency
> scanning 
> for foo, then compiles files.
> 
> Here's what I got:
> $ make
> [ 50%] Generating a.h
> Scanning dependencies of target foo
> [100%] Building C object CMakeFiles/foo.dir/a.o
> Linking C static library libfoo.a
> 
> If that doesn't work for your case, can you be more specific on why it
> doesn't?
> 

hi, your proposal suggests implicit addition of dependency on a.h for the
library. We have tens of libraries, some of which might need dependency on
a.h, some might not. If we add this dependency on those which do not need
it then they will be rebuilt unnecesarilly if the a.txt changes.

What I'd like to see is cmake take care of the dependencies in a way that
when I type 'make foo' and a.txt is changed, then a.h would be
regenerated/created and foo rebuilt with new a.h. I guess cmake has got all
necessary information to convey such operation, since it does scanning of
dependencies on a.c to know its dependency on a.h, it knows that there is a
rule for a.h generation, so why not combine the two automaticaly and make
it work together ?

-Wojciech




----------------------------------------------------------------------
Lecza czy truja? Poczytaj o niezwyklych wlasciwosciach grzybow.
Sprawdz >>> http://link.interia.pl/f232b



More information about the CMake mailing list