summaryrefslogtreecommitdiff
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorlumberyard-employee-dm <mcgarrah@amazon.com>2020-06-11 17:51:19 +0100
committerBrad King <brad.king@kitware.com>2020-06-12 11:40:23 -0400
commit87c860ebadabb669a570119186aabbd99cad1e5e (patch)
tree846f0fd40d2c9b6ab03df5756656637aa998c033 /Source/cmGlobalGenerator.cxx
parent7925279c20754113227202848545804cde30a3b6 (diff)
downloadcmake-87c860ebadabb669a570119186aabbd99cad1e5e.tar.gz
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
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 4dc409221c..1ed5e8b35b 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 += " && ";