diff --git a/Project-Setup.md b/Project-Setup.md index 4b0556e..59fa805 100644 --- a/Project-Setup.md +++ b/Project-Setup.md @@ -85,6 +85,12 @@ Caveat on Windows: CMake dumps Windows shell command line directly into `command jq '[.[] | {directory: .directory, file: .file, arguments: .command | split(" ") | map(select(length > 0)) | map(sub("\\\\\""; "\""; "g"))}]' < compile_commands.json ``` +In some setups, CMake also puts source file of a translation unit (i.e. `*.cpp` file) after two dashes `--`, which means that after it no command-line options can be given. Unfortunately, `ccls` currently tries to add them just to the end. This modification of above helps: + +```sh +jq '[.[] | {directory: .directory, file: .file, arguments: .command | split(" ") | map(select(length > 0 and . != "--")) | 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`.