[CMake] Unity builds (was: Re: [ANNOUNCE] CMake 3.16.0-rc1 is ready for testing)

Robert Maynard robert.maynard at kitware.com
Mon Oct 14 08:33:36 EDT 2019


Hi Paul,

As another reference point, I verified that -DCMAKE_UNITY_BUILD=ON
works with the VTK-m ( https://gitlab.kitware.com/vtk/vtk-m ) project.
I only verified using a clean CMake 3.16 build directory.

On Thu, Oct 10, 2019 at 6:43 PM Paul Smith <paul at mad-scientist.net> 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.
>
> Cheers!
>
> --
>
> 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


More information about the CMake mailing list