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 ?
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.
Sorry, I should be more clear.
compile_commands.json is a format described by LLVM/Clang 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.