[CMake] Help debug crazy Windows MSVC issue

Paul Smith paul at mad-scientist.net
Mon Feb 17 00:20:40 EST 2014


On Sun, 2014-02-16 at 22:38 -0500, David Cole wrote:
> > How can I structure my cmake file to avoid
> > this double build?
> 
> 
> Put the custom command in a custom target, and make the libraries using 
> the generated file depend on the custom target.
> 
> That works, even for parallel builds.
> 
> Google around for examples and similar advice. You'll end up using 
> add_custom_target and add_dependencies in addition to what you already 
> have.

I was thinking about that earlier, but I didn't do it because the docs
for add_custom_target() say:

  The target has no output file and is ALWAYS CONSIDERED OUT OF DATE
  even if the commands try to create a file with the name of the target.

To me this means that every time I run the build, even if nothing has
changed, the files will be regenerated and all the targets that depend
on the files will be recompiled and everything will be relinked.  Am I
misreading it?  That's a pretty significant hit to performance and
productivity, if I understand it properly.

I'll play with it in my test setup and see how it goes.



More information about the CMake mailing list