devtbi / vscode-cppinsights

cppinsights extension for vscode
The Unlicense
12 stars 1 forks source link

How do I use it with cmake project #15

Closed DaydreamCoding closed 4 months ago

DaydreamCoding commented 4 months ago

The project uses cmake to build, there are various header file dependencies, using a single file will find a variety of files.

how to use cppinsights and cmake together

devtbi commented 4 months ago

Guessing what you are looking for is a compilation database: Follow cmake's guide to export the compilation database, and then check the readme of this extension again.

DaydreamCoding commented 4 months ago

Guessing what you are looking for is a compilation database: Follow cmake's guide to export the compilation database, and then check the readme of this extension again.

If cmake.buildDirectory has a default setting but is modified to a new path by cmakepreset's binaryDir, CMAKE_EXPORT_COMPILE_COMMANDS are not found

DaydreamCoding commented 4 months ago

Temporary solution project setting.json:

"cmake.copyCompileCommands" : "${workspaceFolder}/.vscode/compile_commands.json",
"vscode-cppinsights.buildDirectoryPrioritizeCMake": false,
"vscode-cppinsights.buildDirectory": "${workspaceFolder}/.vscode"