[CMake] Fwd: How to have generated source compiled multiple ways?

Paul Smith paul at mad-scientist.net
Wed Aug 14 22:52:57 EDT 2013


On Tue, 2013-08-13 at 00:24 +0200, Eric Noulard wrote:
> > OK, maybe I'm misunderstanding but if the SerializeTarget is considered
> > "always out of date" because it was defined with add_custom_target()
> > then won't that cause the two libraries to always rebuild, since
> > something they depend on is always out of date?  Maybe I'm thinking of
> > it too much like make.
> 
> This is puzzling but as far as I understand it, since SerializeTarget
> has no output it cannot trigger the rebuilt of a target (nioether Lib1
> nor Lib2), however whenever you need (or ask) to build Lib1 or Lib2
> then SerializeTarget has to be executed and consequently the
> add_custom_command will be if the "generated.c" file is out of date.

OK, I was thinking it was like a .PHONY rule in make, but it looks like
it's rather just like a normal empty rule (if it has no commands).  That
works.  Thanks!



More information about the CMake mailing list