Skip to content

Commit

Permalink
Build selected build-target when starting to debug (#2987)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddimax authored Feb 6, 2023
1 parent 488a895 commit f2e51f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.14
Improvements:
- Add an optional description field to kits. [PR #2944](https://github.com/microsoft/vscode-cmake-tools/pull/2944) [@TisziV](https://github.com/TisziV)
- When starting debugging, also build the selected build target. [PR #2987](https://github.com/microsoft/vscode-cmake-tools/pull/2987) [@Maddimax](https://github.com/Maddimax)
- Add support for CMake Presets V5. [#2979](https://github.com/microsoft/vscode-cmake-tools/issues/2979)

Bug Fixes:
Expand Down
8 changes: 7 additions & 1 deletion src/cmakeProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,13 @@ export class CMakeProject {

const buildOnLaunch = this.workspaceContext.config.buildBeforeRun;
if (buildOnLaunch || isReconfigurationNeeded) {
const buildResult = await this.build([chosen.name]);
const buildTargets = await this.getDefaultBuildTargets() || [];
const allTargetName = await this.allTargetName;
if (!buildTargets.includes(allTargetName) && !buildTargets.includes(chosen.name)) {
buildTargets.push(chosen.name);
}

const buildResult = await this.build(buildTargets);
if (buildResult !== 0) {
log.debug(localize('build.failed', 'Build failed'));
return null;
Expand Down

0 comments on commit f2e51f3

Please sign in to comment.