Ninja: Fix object path quoting in compilation database
For the compile_commands.json
file the object file path needs to
be escaped as well, just like the source path. Otherwise tools like
clangd might not be able to parse the commandline properly.
We discovered this behaviour on our repository where we have some library mounted under a directory with spaces. All files in the library were having issues with clangd
in VS Code but not for other users who were using Vim
. As they used Makefiles
that got us to suspect an error with the Ninja generation parts in CMake.
See also our issue filed with the VSCode-Clangd team on GitHub
Edited by Sander Cox