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.
Currently the
CMakePresets.jsoncontains the followingThe
binaryDirhere forces the build to go into the directorybuildin 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.mdall the examples contain the-BflagSo the
-Bis used to override thebinaryDirin theCMakePresets.json.I suspect the
binaryDirin theCMakePresets.jsonis there because it used to be a required field.I would suggest removing the
binaryDirwhich means by default the build tree goes into the directory where you are runningcmakewhich 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.jsonitems for command line builders that don't inheritci-build. The downside of this is that they might drift apart, say by flags, from theci-*presets which are used by CI build.