[CMake] [ADD_CUSTOM_COMMAND] How to add source dependences to the target ouside of the command?

Alexander Neundorf a.neundorf-work at gmx.net
Fri Aug 25 02:38:51 EDT 2006


Von: "Tristan Carel" <tristan.carel at gmail.com>

> Hi dear maintainers, hi lucky users!!!
> 
> The module `UseSwig' provided in the version 2.4.3 provides a macro
> named `SWIG_ADD_MODULE' to define a C/C++ library wrapped for one of
> the targets supported by Swig. This macro uses the command
> `ADD_CUSTOM_COMMAND' to define the rule as below:
> 
> wrapper.cxx: foo.i
>      swig [too many options] foo.i
> 
> But `foo.i' can include other files (.i, .h, ...) so `wrapper.cxx' 's
> build must depend to these other files too. I guess it can't be
> specified by using the macros provided by the module `SWIG_ADD_MODULE'
> 
> So I tried to add dependences to the target `wrapper.cxx' in the "user
> land" (I mean without patching the module `UseSWIG.cmake' :) but I
> failed.
> 
> I guess there are two commands to add dependences to entities:
> `ADD_DEPENDENCIES' and `SET_SOURCE_FILES_PROPERTIES'

I didn't look closely, so...
Since cmake 2.4.3 the recommended way for handling the dependencies of generated files is to simply add the generated files to the list of source files of the target. As long as they don't have a "compilable" suffix, they won't be compiled, but generated.

Bye
Alex

-- 


"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail


More information about the CMake mailing list