[CMake] Reexecute cmake to update build.make

Mathieu Malaterre mathieu.malaterre at gmail.com
Thu Jun 7 10:12:40 EDT 2007


On 6/7/07, gga <ggarra at advancedsl.com.ar> wrote:
> Mathieu Malaterre wrote:
> > Example, your foo.i depends on bla.h. First time your configure,
> > dependency will be right, for instance:
> >
> > Makefile:
> > ...
> > foo_wrap.cpp: foo.i
> > foo_wrap.cpp: bla.h
> > <tab>swig -o foo_wrap.cpp foo.i
> >
> > but now edit your foo.i file and add a new header file 'bar.h'. There
> > is absolutely nothing in the Makefile that will say 'Hey rebuild
> > foo_wrap.cpp, because it now depends on bar.h'
> >
>
> Sure there is, even without those files I gave you.
>
> foo.so depends on foo.obj
> foo.obj depends on foo_wrap.cxx
> foo_wrap.cxx depends on foo.i
>
> when foo.i changes on disk (you added bar.h), foo_wrap.cxx gets
> regenerated and recompiled.
>
> What's missing by default in cmake is:
>
> foo.i   depends on bla.h and other.i  (this is what swig -MF gives you)
>
> so that whenever bla.h or other.i changes, so does foo.so.
>
> With the files I gave you and a proper swig with dependencies (ie. swig
> -MF), you should get that too.  Works beautifully.

It looks like you are on windows. Could you please try a nmake ("NMake
Makefiles") build and do:

1)
edit foo.i
$ nmake TargetName

vs
2)
edit foo.i
$ nmake rebuild_cache
$ nmake TargetName

Version #1 should fail, versus #2 should rebuild build.make, and redo
the correct dep.

IMHO you think this is working because you are either reexecuting
CMake everytime, or Visual Studio has (somehow) a better dependency
checking than the Makefile generator (remember CMake is not doing dep
in the Visual Studio case). In any case this is not my test case :

1. Makefile (== CMake is doing the dep)
2. Do not explicitely reexecute a configure stage

Thanks anyway for your help,
Mathieu


More information about the CMake mailing list