From 97513bcf37eb872ee9b5b3ff974f63974e86a0cb Mon Sep 17 00:00:00 2001 From: Andrew Zabavnikov Date: Fri, 9 Sep 2022 15:07:47 +0300 Subject: [PATCH] Updated Project Setup (markdown) --- Project-Setup.md | 6 ++++++ 1 file changed, 6 insertions(+) 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`.