[cmake-developers] custom_command and compile_commands.json

Brad King brad.king at kitware.com
Mon Nov 27 08:19:20 EST 2017


On 11/22/2017 06:37 AM, Máté Ferenc Nagy-Egri wrote:
> Well, my impression was that it is generally for external tools to be
> aware of the build process, or the commands CMake executes.

`compile_commands.json` was a hack to support clang-tidy and similar tools
and was never meant to be a general way to get information.  It has largely
been superseded by dedicated support for specific tools plus the server mode
query information in a more structured way.

> compile_commands.json is how Microsofts C++ extension to Visual Studio Code
> fetches compiler definitions and include directories.

That should be ported to ask the server mode instead.

> I would like to make the LaTeX Workshop extension also aware of an external
> build system, much as how cpptools can be made aware of external magic.

I don't think we should add custom commands to `compile_commands.json`,
but instead find some other way to export the needed information.  Maybe
LaTeX should be a first-class language.  Or, the same modules that create
the custom commands could also themselves export the information to some
tooling helper file.

-Brad


More information about the cmake-developers mailing list