I have a CMakeLists.txt in combination with CMakePresets.json, Visual Studio 2022 and the generator ninja. Running the build command in Visual Studio 2022 executes
cmake --build --preset Release
My goal is that running the build command in Visual Studio 2022 executes
cmake --build --preset Release | my_script.bat
where my_script.bat is a custom script which takes the output of cmake build as stdin and generates a new output which is displayed in Visual Studio 2022.
Unfortunately, I have not found any CMakePresets option to do this. My ansatz was to use the CMakePresets option "nativeToolOptions", this is
{
"version": 3,
"configurePresets": [
...
],
"buildPresets": [
{
"name": "Release",
"configurePreset": "Release",
"nativeToolOptions": ["foo"]
}
]
}
which results in
cmake --build --preset Release -- "foo"
I tried to break out of nativeToolOptions but I was not successful.