Discussion:
Support of Compilation Databases
Toni Dietze
2018-10-22 19:33:28 UTC
Permalink
Hello,

I have a project with an involved build system and was quite happy to
read that kdevelop supports compilation databases [1]. However, I was
not able to find out how to convince kdevelop to use my compilation
database. I have two questions:

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?

2. Is it possible to load an arbitrary compilation database as
a project? This would be a great feature. It would already be helpful
if the code is only opened read-only just for browsing.

[1] http://kfunk.org/2016/08/23/whats-new-in-kdevelop-5-0/#cmakesupport
--
Regards

Toni
Milian Wolff
2018-10-23 08:15:23 UTC
Permalink
Post by Toni Dietze
Hello,
I have a project with an involved build system and was quite happy to
read that kdevelop supports compilation databases [1]. However, I was
not able to find out how to convince kdevelop to use my compilation
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?
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.
Post by Toni Dietze
2. Is it possible to load an arbitrary compilation database as
a project? This would be a great feature. It would already be helpful
if the code is only opened read-only just for browsing.
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!

Cheers
Post by Toni Dietze
[1] http://kfunk.org/2016/08/23/whats-new-in-kdevelop-5-0/#cmakesupport
--
Milian Wolff
***@milianw.de
http://milianw.de
René J.V. Bertin
2018-10-23 08:26:52 UTC
Permalink
Post by Milian Wolff
Post by Toni Dietze
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...
Post by Milian Wolff
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).
Post by Milian Wolff
Post by Toni Dietze
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.

Loading...