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.

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to