Given the following presets construct (not a complete presets file)
{
"configurePresets": [
{
"name": "fooConfig",
"binaryDir": "${sourceParentDir}/build-foo"
}
],
"buildPresets": [
{
"name": "foo",
"configurePreset": "fooConfig",
"targets": "myapp"
}
]
}
I find that when I try:
cmake --build --preset foo
It fails on a pristine system with error
Error: C:/{..}/build-foo is not a directory
When I read up on build presets, I imagined that cmake would configure and build conveniently from this one command, but I guess that I may be wrong?
Instead I have to explicitly run the configuration through and then instruct the build, like so
cmake --preset fooConfig
cmake --build --preset foo
I suppose it hides away the actual location of the build, but that is of little gain (to me).
So what are the perks of build presets?
The same question was asked on the cmake forum, but the person answering didn't truly understand what the OP was asking.
Can a cmake build preset run a configuration
No.
what are the perks of build presets?
From https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html :
One problem that CMake users often face is sharing settings with other people for common ways to configure a project. This may be done to support CI builds, or for users who frequently use the same build. CMake supports two main files, CMakePresets.json and CMakeUserPresets.json, that allow users to specify common configure options and share them with others. CMake also supports files included with the include field.