On 2019-10-10 18:21-0400 Paul Smith wrote:

On Thu, 2019-10-10 at 14:57 -0400, Robert Maynard via CMake wrote:
* The "UNITY_BUILD" target property was added to tell generators to
  batch include source files for faster compilation times.

Are there any instructions on how to make this work?  I tried this:

 cmake -G 'Unix Makefiles' -DCMAKE_UNITY_BUILD=ON .

Then ran "make".  The output showed I had just as many output .o files
as input .cpp files and that make ran one compile command per .cpp
file.

Is there something else I need to do to enable unity builds in my cmake
files, than just give the above option?  The docs imply that the above
is all that's needed.

Hi Paul:

I have never tried unity builds, but your question did inspire me to
look at [the unity build
documentation](https://cmake.org/cmake/help/latest/prop_tgt/UNITY_BUILD.html)
which if you follow the links to other related documentation does imply what
you have done above is correct and should by default group 8
source-code files into a lump to be compiled together.  Since you are
not getting that behaviour, I am wondering if one or more of the
documented reasons for skipping unity builds is making a difference in your
case. Those reasons are the following:

"The source files marked by GENERATED will be skipped from unity build. This 
applies also for the source files marked with SKIP_UNITY_BUILD_INCLUSION.

The source files that have COMPILE_OPTIONS, COMPILE_DEFINITIONS, COMPILE_FLAGS, or 
INCLUDE_DIRECTORIES will also be skipped."

Good luck, and I hope you will keep the list informed of any further
progress you make with your unity build experiments.

Alan
__________________________
Alan W. Irwin

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.org); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
--

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:
https://cmake.org/mailman/listinfo/cmake

Reply via email to