Re: Support of Compilation Databases

René J.V. Bertin <[email protected]>
Newsgroups gmane.comp.kde.users.kdevelop
Message-ID <4475807.24AjmGYsgj@bola>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.