binary build dir in CMakePresets.json
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 76
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
Currently the CMakePresets.json contains the following
{
"name": "ci-build",
"binaryDir": "${sourceDir}/build",
"hidden": true
},
The binaryDir here forces the build to go into the directory build in the source tree. I think this is a very bad idea.
Maybe for CI builds this is OK as you may spin up a totally new environment for every build but if you are building local copies
they can clash. For instance you use WSL and want to build a GCC and a VS build using the same source tree. This is how I ran
into this.
It is noticeable that in BUILDING.md all the examples contain the -B flag
cmake -B build --preset=test-msvc
So the -B is used to override the binaryDir in the CMakePresets.json.
I suspect the binaryDir in the CMakePresets.json is there because it used to be a required field.
I would suggest removing the binaryDir which means by default the build tree goes into the directory where you are running cmake which is what most people probably expect. You can always still override this on the command line using -B.
An alternative would be to add CMakePresets.json items for command line builders that don't inherit ci-build. The downside of this is that they might drift apart, say by flags, from the ci-* presets which are used by CI build.
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 CMakePresets.json and the ci-build preset, then compare its binaryDir behavior with the -B examples in BUILDING.md. Verify that the preset supports separate local build directories without clashing, and run the documented CMake configure commands to confirm the resulting build trees.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 62/100