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

Paul Smith paul at mad-scientist.net
Thu Oct 10 18:53:42 EDT 2019


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.

For some reason this didn't work with my actual cmake environment, but
I could enable it on a simple test environment.  I can look into that
later.

Here my concern is that you cannot use unity builds if you need
compile_commands.json (-DCMAKE_EXPORT_COMPILE_COMMANDS=ON); for example
if this is required by your IDE or other build tools.  When unity
builds are enabled the json file is not usable since it contains only
commands for the unity source files and doesn't describe the original
source files.

Is there an intent to address this before the 3.16 release?  

Or is this a known limitation, which may or may not be addressed in
some future version of CMake?

If the latter it should probably be added to the release notes and/or
documentation for unity builds.

Thanks!



More information about the CMake mailing list