add_custom_command with multiple commands on windows

I just noticed that when I do an add_custom_command on Windows (Visual Studio Generator, tested with 2019 and 2022), and I want to execute multiple commands for a “build step” (e.g. POST_BUILD) (or if there is another command added somewhere else, such as from automatic moc’ing), I need to prefix the command that I want to execute with call, otherwise the only one of the commands (the first one) will be executed; Visual Studio stops after the first command, without reporting any errors.

Is this something known? I couldn’t find anything on this so far, but also would expect I am not the only one needing something like this to work. The inspiration for trying call came from this stackoverflow question. The Microsoft documentation on call seems to only mention it in the context of calling batch scripts, but I can confirm it also works with calling executables (.exe).

Maybe this should be documented in the add_custom_command documentation?

Please provide a complete, minimal example project which shows what you expect to work. Be sure to make clear what each command being invoked is as well (executable, batch file, etc.). The details of those things may be important.

Good point, should have thought of that before! On trying to reproduce the problem, I realized that what I am calling (what I thought were executables) are actually .cmd files. Having to use call for those in order not to abort subsequent steps is to be expected on Windows, I guess…