Skip to content

Ability to pass custom target to "CMake: Build Target" command (aka cmake.buildWithTarget) as argument #3598

@i-ky

Description

@i-ky

Brief Issue Summary

I would like to configure a task which would depend on building a specific target. It is possible to call a command from a task using "inputs", tasks.json would look something like this:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Build Target",
      "command": "echo ${input:buildTarget}",
      "type": "shell",
      "problemMatcher": []
    }
  ],
  "inputs": [
    {
      "id": "buildTarget",
      "type": "command",
      "command": "cmake.buildWithTarget",
      "args": "targetName"
    }
  ]
}

Unfortunately, cmake.buildWithTarget does not support receiving target as argument, instead it unconditionally prompts user for target selection:

async buildWithTarget(): Promise<number> {
const target = await this.showTargetSelector();

This is not acceptable in my use case, because there is a specific target I want to build and I don't want to bother workspace users with target selection (which would be non-user-friendly and error-prone).

Could you please make cmake.buildWithTarget accept target as argument?

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature: buildenhancementan enhancement to the product that is either not present or an improvement to an existing featurehelp wantedwe currently are not planning work on this and would like help from the open source community

    Type

    No type

    Projects

    Status

    Completed

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions