cmake --build: Fix exit code when building multiple targets

Updated the cmGlobalGenerator::Build method to check the return `retVal`
parameter supplied to the `cmSystemTools::RunSingleCommand` to validate
that each invocation of the build command returned an exit code of zero.

Fixes: #20790
This commit is contained in:
lumberyard-employee-dm
2020-06-11 17:51:19 +01:00
committed by Brad King
parent 7925279c20
commit 87c860ebad

View File

@@ -1988,8 +1988,9 @@ int cmGlobalGenerator::Build(
std::string makeCommandStr;
output += "\nRun Build Command(s):";
for (auto command = makeCommand.begin(); command != makeCommand.end();
++command) {
retVal = 0;
for (auto command = makeCommand.begin();
command != makeCommand.end() && retVal == 0; ++command) {
makeCommandStr = command->Printable();
if (command != makeCommand.end()) {
makeCommandStr += " && ";