Support of Compilation Databases

René J.V. Bertin rjvbertin at gmail.com
Tue Oct 23 09:26:52 BST 2018


On Tuesday October 23 2018 10:15:23 Milian Wolff wrote:

>> 1. If I have a cmake project with enabled
>> CMAKE_EXPORT_COMPILE_COMMANDS, how do I notice that kdevelop actually
>> uses the generated compilation database?

Currently, if you have a recent (> 3.0.1 I think) CMake version the compile_commands file will only be used by the likes of the clazy plugin. As far as I know...

>Since some time, we prefer the cmake server mode over the compilation 
>database. Generally, you shouldn't need to enable 
>CMAKE_EXPORT_COMPILE_COMMANDS yourself - just open a cmake project in KDevelop 
>and everything should be handled automatically for you.

FWIW, the few times I looked at this in detail (even recently) I noticed that the initial import with cmake server mode has somewhat unexpected (to me) behaviour, or at least differences from what the legacy import mode does:
1) it ignores any "extra arguments" you may have configured but does create a CMakeCache file (which can lead to conflicts when you run cmake explicitly later on, which does use the extra arguments)
2) no compile_commands file is created, which is probably a consequence of point 1).

>
>> 2. Is it possible to load an arbitrary compilation database as
>> a project? This would be a great feature. It would already be helpful

>Yes, that's indeed a good idea. But so far, it's not implemented from what I 
>can remember. Adding such a feature to the custom buildsystem project manager 
>would be a welcome addition!

See my thread "compiledb-generator and the generic Makefile proj.manager" and the reply from Francis. He's been looking into it with another user, and from what I understand the results were promising (not unsurprisingly :)).

R.



More information about the KDevelop mailing list