Add wrappers for 'zig c++' to work around clangd
This commit is contained in:
19
README.md
19
README.md
@@ -16,3 +16,22 @@ You can create toolchains for other triples like this. Here is an example to bui
|
||||
set(ZIG_TARGET "aarch64-windows-gnu")
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/zig-toolchain.cmake)
|
||||
```
|
||||
|
||||
## clangd
|
||||
|
||||
To get [clangd](https://clangd.llvm.org/) to work you need to first enable generation of `compile_commands.json`:
|
||||
|
||||
```sh
|
||||
cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||
```
|
||||
|
||||
Additionally you need to pass pass the following arguments to `clangd`:
|
||||
|
||||
```json
|
||||
"clangd.arguments": [
|
||||
"--log=verbose",
|
||||
"--query-driver=*/clang-cl.exe,*/zig-cc.*,*/zig-c++.*,*/em++.bat,*/emcc.bat,*/em++,*/emcc",
|
||||
]
|
||||
```
|
||||
|
||||
Without these arguments `clangd` will not query the driver (`zig c++`) and the include paths will not be resolved correctly.
|
||||
|
||||
Reference in New Issue
Block a user