[cmake-developers] Generating information for C++ tools in cmake (patch)

Manuel Klimek klimek at google.com
Thu Jan 13 18:05:14 EST 2011


On Thu, Jan 13, 2011 at 1:30 PM, Brad King <brad.king at www.kitware.com> wrote:
> On 01/12/2011 11:47 PM, Manuel Klimek wrote:
>> Split up the patch - apparently I need ssh access to push the topic
>> stuff, so I'm just attaching the patches.
>
> Thanks.  That's pretty clean.  In the final version of this topic please
> add one more intermediate commit that optimizes GetFlags and GetDefines
> to cache their result for each language.  Otherwise they get invoked
> once for the target (as in current CMake) plus once for each source file
> (after the second patch).

Will do.

> About the name "cxx_commands.json" of the file:  I'd like to hide this
> away from the casual user by putting it in the CMakeFiles subdirectory.
> The commands can be for compilation of any language so it should be
> called something like "CMakeFiles/compile_commands.json" instead.

I think that finding this file in the same spot relative to the base
build directory independently of the build system used will make it a
lot easier for tool-smiths / users to actually make use of it. If you
want to hide it away, I'd vote for a more build system independent
name than CMakeFiles.

The commands are currently only for c/c++ compilation, but I'm fine
with "compile_commands" to keep it flexible.

> About the content of the json file: I suggest that each command also
> include a "language" field indicating "C", "C++", or "Fortran".  That
> will help tools know how to treat the file named by the "file" field.
> One might also include a "target" field indicating the name of the
> logical target to which it belongs.  I don't know whether this is
> useful in your case or not.

I'd rather keep it focused for now, and add additional things later if
you're ok with that.

Cheers,
/Manuel



More information about the cmake-developers mailing list