#TodayILearned that when building a #CMake project using #CMakePresets, it is absolutely essential to specify the `binaryDir`, as otherwise `cmake --build --preset <preset>` will err with the ambiguous error message:
"Error: is not a directory"

This is not very well explained by the documentation that simply states:

> cmake --build --preset <preset>
>
> --build <dir>
> Project binary directory to be built. This is required (unless a preset is specified) ...

Cf. https://cmake.org/cmake/help/latest/manual/cmake.1.html#build-a-project

cmake(1) — CMake 4.3.1 Documentation

wrote my first CMakePresets.json file yesterday.

I like it, I guess? Now I don't have to write a Makefile or a BUILDING.md that is just copypasta of my command line arguments. Can just say "use the xyz cmake preset"

1. Why json? (but at least it allows comments)
2. I wish it would just use the presets file by default
3. especially if there's a preset named "default"

#cmake #cmakePresets

In my never-ending quest to master CMake, I developed a few opinions on how I want my projects to work and finally looked at "CMake Presets" in my latest article.

#CMake #CmakePresets #CTest #Cpp

https://martin-fieber.de/blog/cmake-presets/

A TL;DR about CMake Presets

Utilizing CMake's presets was the missing piece to truly make it easy to set up and maintain projects, now that I have developed a few opinions of how I want them to be set up.