Important: Please read the Qt Code of Conduct -

QtCreator Clang Code Model with compile_commands.json

  • Hi,

    The clang code model in QTC works pretty well for me, however the project I work on has many differing compile lines for groups of translation units using a bespoke makefile system (i.e. not cmake/qmake based). Is it possible to provide a compile_commands.json so that the clang tool can match the actual compilation?

    Thanks, Bryan.

  • Lifetime Qt Champion


    Do you mean you would like to start a new tool for Qt Creator to handle bespoke ? Or just run it ? There's some explanation there.

  • Hi @SGaist,

    Thanks for the reply.

    I mean I have a monolithic project with a custom Makefile based build system with (at least) 13k source files, I can edit/build/run/debug this project fine in QTC (which other IDEs struggle with due to the volume).

    I use the clang code model which works ok, but since the build configuration is controlled by the custom Makefile system what QTC 'knows' about each translation unit's compilation switches is not very accurate, and these switches vary on certain groups of files, for historical reasons.

    Clang tooling can read a compile_commands.json file so I am wondering if it is possible for the clang code model to use this when invoked from within QTC.

  • Lifetime Qt Champion

    Sounds interesting, however I'm sorry I don't know if that can be achieved out of the box.

    I'd recommend bringing this to the Qt Creator mailing list. You'll find there Qt Creator developers/maintainers.

Log in to reply