microsoft / microsoft/vscode-cmake-tools

CMake build from task not working after Open Folder

Open
#1,595 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature: build Feature: configure Feature: engineering Feature: tasks
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Brief Issue Summary

As of fixing bug #1234, running CMake build from task is basically working, but not right after Open Folder command.
1. Have a project with CMakeLists.txt in it's root directory.
2. Have this in tasks.json:

```
{
"version": "2.0.0",
"tasks": [
{
"label": "CMake Build",
"type": "cmake",
"command": "build",
"group": "build"
}
]
}
```
3. In launch.json:
```
{
"version": "0.2.0",
"configurations": [
{
...
"preLaunchTask": "CMake Build"
...
}
]
}
```
4. After opening the project using Open Folder command(also, in case it opens automatically at VSCode start), I press F5 key to build project and run it.

### Expected:

Project to be built and run.

### Apparent Behavior:

Got an error in output tab:

```
Error: The cmake task detection didn't contribute a task for the following configuration:
{
"label": "CMake Build",
"type": "cmake",
"command": "build",
"group": "build"
}
The task will be ignored.
```
But after I modify somehow tasks.json(e.g. enter space, delete it and save file), launch works as expected, task found successfully.
If then I open some other folder, and then reopen the project folder again, CMake Build task recognition fail again.

### Platform and Versions

- **Operating System**: Linux Mint 19
- **CMake Version**: 3.5.1
- **VSCode Version**: 1.51.1
- **CMake Tools Extension Version**: v1.5.3
- **Compiler/Toolchain**: arm-none-eabi-gcc 4.8

### Other Notes/Information

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure using the listed tasks.json and launch.json after Open Folder, then compare it with behavior after saving tasks.json. Start by tracing CMake task detection during folder opening; done means the CMake Build task is recognized immediately and F5 builds and runs the project without editing tasks.json.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript, vscode
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.