How to set CMAKE_EXPORT_COMPILE_COMMANDS?

Stated here: https://developer.blender.org/docs/handbook/development_environments/vscode/#cc-intellisense

If CMAKE_EXPORT_COMPILE_COMMANDS is enabled in CMake, a compile_commands.json file is created in the build directory. The C/C++ extension can use this file to know the current include paths and build options.

I’m wondering what is the right way to set CMAKE_EXPORT_COMPILE_COMMANDS for blender.

I did find:

But it tells:

If you run cmake.exe -DCMAKE_EXPORT_COMPILE_COMMANDS=ON followed by other options, …

The followed by other options is to vague for me.
Could someone help?

just go into your build directory and run cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ./ and you’ll be ok.

1 Like