From 7a1038e56c413502dd050b5ccca4613ee499ab33 Mon Sep 17 00:00:00 2001 From: Snow Faerie Date: Fri, 19 Jul 2024 19:11:46 +0200 Subject: [PATCH] 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. --- .gitignore | 1 + CMakePresets.json | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 54bb06ab0b..3c66f5686d 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,7 @@ OpenSCAD_rc.py tags /CMakeUserPresets.json Testing +compile_commands.json # crowdin file src/Tools/freecad.zip diff --git a/CMakePresets.json b/CMakePresets.json index 24c844f2c5..094e1d75ca 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -10,6 +10,10 @@ "name": "common", "hidden": true, "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": { + "type": "BOOL", + "value": "ON" + } } }, {