microsoft / microsoft/vscode-cmake-tools

[Feature] Auto-build codegen target

Open
#4,546 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Request Overview

When using an C++ LSP, it requires the compile_commands.json
This often refers to include paths of generated code, so as you switch to a cmake configure preset having a different build tree directory, the LSP server will parse the code and give errors as the generated code does not exist.

CMake 3.31 introduced a codegen target (see https://cmake.org/cmake/help/latest/release/3.31.html).
We use a version before it, where we created this target manually.

It would be nice if after the switching of configure preset, it would automatically build the codegen target. This is basically: `cmake --build --preset= --target=codegen`.
This way, LSP servers can parse the C++ code and have the generated code available such that you don't get errors.

### Additional Information

_No response_

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

Start by tracing how switching a CMake configure preset is handled and where the existing build command is assembled. Check how a selected build preset can invoke the manually created codegen target. Done means switching presets automatically runs `cmake --build --preset= --target=codegen` so generated C++ code is available to the LSP.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.