4 ms·
CMake does but I think you have to attempt a build to get the database. On the other hand I don't think that should be necessary, as it is capable of generating
by wakawaka28 2y ago
CMake does but I think you have to attempt a build to get the database. On the other hand I don't think that should be necessary, as it is capable of generating Ninja build files.
Almost nobody is writing Ninja files by hand. If you have to write something along those lines by hand, Makefiles would make more sense than Ninja. If Ninja does support exporting commands, it's a use case that doesn't matter because almost everyone uses CMake-generated Ninja files.
- jchw 2y agoYou do not need to attempt a build with CMake. Also, that's kind of the point of mentioning Ninja. Inherently, anything that uses Ninja is in the same boat and doesn't need to start a build.
- wakawaka28 2y agoThe only thing I know that uses Ninja is CMake and I'm sure CMake does not require Ninja to generate the database.
- jchw 2y agoThe most obvious example is the build system of Chromium, which uses gn. They do have a wrapper script to actually generate the compile_commands.json file, but it's just a thin wrapper around Ninja's built-in capabilities. (I'm not sure that CMake's isn't, on that note; I'm pretty sure it's ability to build the database is in fact dependent on which generator you're using.)
- mathstuf 2y agoYes, only generators where CMake actually controls the command line itself support compilation databases (basically, non-IDE generators). FD: CMake developer