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?