[CMake] SWIG dependencies

Brad King brad.king at kitware.com
Thu Mar 31 14:29:24 EST 2005


Anton Deguet wrote:
> I am using SWIG with CMake and I am having some trouble with
> dependencies.  The dependency on the SWIG interface file (aka .i or
> .swig) works well but I can't find a clean way to manage dependencies on
> what is used by the interface file, i.e. using %include or %import (and
> cascading #include).
> 
> Swig can generate a list of dependencies usable by a Unix Makefile using
> the option -MM (or -M -MF myFile.d) but I guess this is not portable and
> I don't really know how to include these dependencies in CMake. 
> Actually, is there a CMake function/macro to load Unix dependencies and
> transform them in CMake dependencies ...
> 
> Has anyone found/proposed a nice way to handle this with CMake?

What you need is a dependency scanner that is specific to an 
ADD_CUSTOM_COMMAND.  There is no way to do this right now, but please 
add it as a feature request here:

http://www.cmake.org/Bug

For now you can approximate the dependencies by using the FILE and 
STRING commands to parse out dependencies using CMake.  It probably 
isn't a scalable solution but will be better than nothing.

-Brad


More information about the CMake mailing list