Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cmake.exportCompileCommandFile to package.json #1559

Merged
merged 7 commits into from
Jan 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,11 @@
"always",
"never"
]
},
"cmake.exportCompileCommandsFile": {
"type": "boolean",
"default": true,
"description": "%cmake-tools.configuration.cmake.exportCompileCommandsFile.description%"
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,6 @@
"cmake-tools.configuration.cmake.statusbar.advanced.ctest.color.description": "Enables a change in color for this button depending on test results.",
"cmake-tools.configuration.cmake.statusbar.advanced.length.description": "Configures the maximum length of visible text in 'compact' mode.",
"cmake-tools.configuration.views.cmake.folders.description": "Folders",
"cmake-tools.configuration.views.cmake.outline.description": "Project Outline"
"cmake-tools.configuration.views.cmake.outline.description": "Project Outline",
"cmake-tools.configuration.cmake.exportCompileCommandsFile.description": "Enables exporting compile_commands.json."
}
7 changes: 4 additions & 3 deletions src/drivers/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1030,10 +1030,11 @@ export abstract class CMakeDriver implements vscode.Disposable {
settingMap.BUILD_SHARED_LIBS = util.cmakeify(this._variantLinkage === 'shared');
}

// Always export so that we have compile_commands.json
settingMap.CMAKE_EXPORT_COMPILE_COMMANDS = util.cmakeify(true);

const config = vscode.workspace.getConfiguration();
// Export compile_commands.json
const exportCompileCommandsFile: boolean = config.get("cmake.exportCompileCommandsFile") === undefined ? true : (config.get("cmake.exportCompileCommandsFile") || false);
settingMap.CMAKE_EXPORT_COMPILE_COMMANDS = util.cmakeify(exportCompileCommandsFile);

const allowBuildTypeOnMultiConfig = config.get("cmake.setBuildTypeOnMultiConfig") || false;

if (!this.isMultiConf || (this.isMultiConf && allowBuildTypeOnMultiConfig)) {
Expand Down