# compile\_commands, great, why is there no link\_commands

**URL:** https://discourse.cmake.org/t/compile-commands-great-why-is-there-no-link-commands/698
**Category:** Usage
**Created:** [February 25, 2020, 9:06am UTC](https://discourse.cmake.org/t/compile-commands-great-why-is-there-no-link-commands/698 "2020-02-25T09:06:22Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Lieven](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/c37758/32.png) [@Lieven](https://discourse.cmake.org/u/Lieven)
#### Post date: [February 25, 2020, 9:06am UTC](https://discourse.cmake.org/t/compile-commands-great-why-is-there-no-link-commands/698/1 "2020-02-25T09:06:22Z")

</div>

by specifying “CMAKE\_EXPORT\_COMPILE\_COMMANDS” one can obtain the json compilation database, which can be used for many aspects (tools, but also manual inspection to check with which options a certain file got compiled).  
For the inspection use case, I have the feeling that a similar concept for linking would be very useful. TO see which linker statements were carried out, which options, order of the libraries …

What do you think ? Is there any particular reason this is not implemented ?

kind regards.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 28, 2020, 8:08pm UTC](https://discourse.cmake.org/t/compile-commands-great-why-is-there-no-link-commands/698/2 "2020-02-28T20:08:38Z")

</div>

The problem there is that `compile_commands.json` doesn’t have a way to specify this (in particular, what goes into the `file` attribute of the object?). This is because it is TU-oriented. I suggest engaging LLVM to see about extensions to the compilation database rather than having CMake forge ahead with its own extensions.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 28, 2020, 8:16pm UTC](https://discourse.cmake.org/t/compile-commands-great-why-is-there-no-link-commands/698/3 "2020-02-28T20:16:43Z")

</div>

Sorry, I should be more clear. `compile_commands.json` is a format [described by LLVM/Clang](https://clang.llvm.org/docs/JSONCompilationDatabase.html) and used by many tools. I don’t know that making our own extensions on-demand is the best procedure for extending or abstracting out the format used without also documenting what it is.
