Generate compile_commands.json

Modify CMakePresets.json to use -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON
in all the presets.

The compile_commands.json file can be used by tools like clangd to get
autocompletion and go-to-definition.

This patch also adds compile_commands.json to the .gitignore, as often
you need to symlink the compile_commands.json from the build directory
into the source directory for it to be picked by tools. That is the case
with clangd at least.
This commit is contained in:
Snow Faerie
2024-07-19 19:11:46 +02:00
committed by Chris Hennes
parent dde1a3511b
commit 7a1038e56c
2 changed files with 5 additions and 0 deletions

1
.gitignore vendored
View File

@@ -54,6 +54,7 @@ OpenSCAD_rc.py
tags
/CMakeUserPresets.json
Testing
compile_commands.json
# crowdin file
src/Tools/freecad.zip

View File

@@ -10,6 +10,10 @@
"name": "common",
"hidden": true,
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": {
"type": "BOOL",
"value": "ON"
}
}
},
{