microsoft / microsoft/vscode-cmake-tools
`cmake.buildDirectory` shouldn't be ignored if no `binaryDir` in cmake presets
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 546
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 32
Description
Brief Issue Summary
I have read this issue.
In my case, I use CMake presets in several IDEs. However, some conflict happened when I set the same build directory in different IDEs. So I tried to set a separate directory in each IDE, and remove all binaryDir fields in my CMakePresets.json.
I have tested that cmake --preset=xxx -B my/build/dir -S . successfully build the project in my/build/dir.
But in vscode-cmake-tools, when I set "cmake.buildDirectory: "my/build/dir" in settings.json, it's ignored, and an option, -B out/build, is always appended in command line.
Then I tried to set "cmake.configureArgs": [ "-B my/build/dir" ], now the command line become cmake ... -B my/build/dir -B out/build. The directory out/build is used because of the order of options.
Along the way, I noticed that vscode-cmake-tools doesn't seem to use cmake --preset(available from cmake 3.19), instead it parses the CMakePresets.json and setups the command line options. This can be a nice workaround for old version cmake users, but make the command line complex, which is hard to check errors.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the preset-setting behavior described in docs/cmake-presets.md and reproduce it using CMakePresets.json, settings.json, and a preset without binaryDir. Compare the generated configure command with the reported cmake.buildDirectory and configureArgs cases. Done means the configured directory is respected without an unwanted -B out/build argument.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, typescript, vscode
- Domain
- build-system, developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100