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

Alexander Neundorf neundorf at kde.org
Tue Jan 11 15:45:03 EST 2011


Hi,

On Tuesday 11 January 2011, Manuel Klimek wrote:
> Hi,
>
> we're working on C++ tools based on clang to get the power of
> automated refactoring and analysis that Java has known for years to
> C++ developers.

Sounds great :-)

> With the attached patch I include a proposal for how we could export
> the compile command line for C/C++ files from cmake for Unix makefile
> generators:
> The idea is to output a small JSON database with all C/C++ files in
> the project, which contains
> - the file's path
> - the working directory in which the compile runs
> - the compile command

To me this sounds a bit like it should be a separate generator, like the 
Eclipse/CodeBlocks/KDevelop generators. They generate Makefiles and 
additionally project files.
This one could generate the Makefiles and additionally the json file.

Do you plan to put only the compile commands into the json-file or also the 
commands needed for linking the targets etc. ?
In this case, the json file could maybe used by itself as project file for an 
IDE...

> Background:
> While C++ refactoring and analysis tools are not compilers, and thus
> don't run as part of the build system, they need the exact information
> of a build in order to be able to correctly understand the C++ code of
> the project. The natural candidate to export that information is the
> build system. We chose cmake to provide a first implementation, as
> cmake is the current open source standard build system for large scale
> C++ projects (like clang itself), and as such it is in the best
> position to define a standard way to make compile commands accessible
> for tools in the open source world.
>
> Example tools:
> - running clang -fsyntax-only over source code from an editor to get
> fast syntax checks
> - running match/replace tools over C++ code (a project we're currently
> working on)
>
> Any feedback would be highly appreciated. If you think the way this is
> implemented is a dumb idea (which it probably is), please tell me - I
> don't have a lot of experience in the cmake architecture. Also, if you
> object to the idea of exporting this information in general, please
> let me know.

These are only my 2 cents, what do the other cmake devs think ?

Alex



More information about the cmake-developers mailing list