[CMake] Reexecute cmake to update build.make

Mathieu Malaterre mathieu.malaterre at gmail.com
Thu Jun 7 09:20:13 EDT 2007


On 6/7/07, gga <ggarra at advancedsl.com.ar> wrote:
> Mathieu Malaterre wrote:
> > This is a follow up on a previous post.
> >
> > I have written a simple dependency scanner macro (*). There is still
> > one dependency missing:
> > I need to reexecute the CMake macro every time the swig *.i file is
> > modified.
> >
> > How do I do that ?
> >
>
> You don't.  You add the dependencies directly and let CMake do its magic.

There is nothing magic in cmake. If you want a special dependencie to
happen on language other than C/CPP/Java/Fortran to have to specify
them explicitely.

> BTW... in the bug list there's already a UseSWIG with dependency
> scanning/updating (don't recall who did it).

I forgot to re-mention, that I cannot use this solution as I am using
an older swig executable that do not have -MM flag...

> I attach my modified versions of such (which work with cmake2.5 now),
> and also find swig a tad better.

...but anyway the very same exact problem occurs:

> MACRO(SWIG_GET_WRAPPER_DEPENDENCIES swigFile genWrapper language DEST_VARIABLE)
>   EXECUTE_PROCESS(
>     COMMAND ${SWIG_EXECUTABLE} -MM -MF ${swig_getdeps_depsfile} ${swig_getdeps_extra_flags} ${CMAKE_SWIG_FLAGS} -${language} -o ${genWrapper} ${swig_getdeps_include_dirs} ${swigFile}
...

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'

Thanks for help,
-Mathieu


More information about the CMake mailing list