From 87c860ebadabb669a570119186aabbd99cad1e5e Mon Sep 17 00:00:00 2001 From: lumberyard-employee-dm Date: Thu, 11 Jun 2020 17:51:19 +0100 Subject: 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 --- Source/cmGlobalGenerator.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4dc4092..1ed5e8b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -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 += " && "; -- cgit v0.12