summaryrefslogtreecommitdiffstats
path: root/Source/cmForEachCommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2008-01-23 15:28:26 (GMT)
committerKen Martin <ken.martin@kitware.com>2008-01-23 15:28:26 (GMT)
commit0e69d38004787f1d55eb7188cde4cf45e0a3957d (patch)
tree6cde7d0b5ef4b0b9b6d4fc90db463418e073776b /Source/cmForEachCommand.cxx
parent72a301f88008c3d98c4ae1f263084763dc662b31 (diff)
downloadCMake-0e69d38004787f1d55eb7188cde4cf45e0a3957d.zip
CMake-0e69d38004787f1d55eb7188cde4cf45e0a3957d.tar.gz
CMake-0e69d38004787f1d55eb7188cde4cf45e0a3957d.tar.bz2
ENH: add return and break support to cmake, also change basic command invocation signature to be able to return extra informaiton via the cmExecutionStatus class
Diffstat (limited to 'Source/cmForEachCommand.cxx')
-rw-r--r--Source/cmForEachCommand.cxx27
1 files changed, 23 insertions, 4 deletions
diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx
index 1f9b84c..848c6a4 100644
--- a/Source/cmForEachCommand.cxx
+++ b/Source/cmForEachCommand.cxx
@@ -17,9 +17,10 @@
#include "cmForEachCommand.h"
bool cmForEachFunctionBlocker::
-IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
+IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
+ cmExecutionStatus &inStatus)
{
- // Prevent recusion and don't let this blobker block its own
+ // Prevent recusion and don't let this blocker block its own
// commands.
if (this->Executing)
{
@@ -54,9 +55,26 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
// set the variable to the loop value
mf.AddDefinition(this->Args[0].c_str(),j->c_str());
// Invoke all the functions that were collected in the block.
+ cmExecutionStatus status;
for(unsigned int c = 0; c < this->Functions.size(); ++c)
{
- mf.ExecuteCommand(this->Functions[c]);
+ status.Clear();
+ mf.ExecuteCommand(this->Functions[c],status);
+ if (status.GetReturnInvoked())
+ {
+ inStatus.SetReturnInvoked(true);
+ // restore the variable to its prior value
+ mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str());
+ mf.RemoveFunctionBlocker(lff);
+ return true;
+ }
+ if (status.GetBreakInvoked())
+ {
+ // restore the variable to its prior value
+ mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str());
+ mf.RemoveFunctionBlocker(lff);
+ return true;
+ }
}
}
// restore the variable to its prior value
@@ -105,7 +123,8 @@ ScopeEnded(cmMakefile &mf)
mf.GetCurrentDirectory());
}
-bool cmForEachCommand::InitialPass(std::vector<std::string> const& args)
+bool cmForEachCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
if(args.size() < 1)
{