diff --git a/compile_commands.json.md b/compile_commands.json.md index 529ec7b..bd35a95 100644 --- a/compile_commands.json.md +++ b/compile_commands.json.md @@ -8,6 +8,12 @@ % ln -s build/compile_commands.json ``` +Caveat on Windows: CMake dumps Windows shell command line directly into `command`, depends on how ccls was built, it may confuse this field as command line from a POSIX shell, in which Windows path separator '\\' is a escape character. You can use jq to convert such entries to use `arguments` which does not have this issue: + +```sh +jq '[.[] | {directory: .directory, file: .file, arguments: .command | split(" ") | map(select(length > 0)) | map(sub("\\\\\""; "\""; "g"))}]' < compile_commands.json +``` + ### [Build EAR](https://github.com/rizsotto/Bear) Bear is a tool that generates a compilation database for clang tooling. It can be used for any project based on `Makefile`.