Browse Source

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

Ken Martin 18 years ago
parent
commit
0e69d38004
100 changed files with 415 additions and 135 deletions
  1. 2 2
      Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
  2. 2 1
      Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h
  3. 2 2
      Source/CTest/cmCTestHandlerCommand.cxx
  4. 2 1
      Source/CTest/cmCTestHandlerCommand.h
  5. 2 2
      Source/CTest/cmCTestReadCustomFilesCommand.cxx
  6. 2 1
      Source/CTest/cmCTestReadCustomFilesCommand.h
  7. 2 2
      Source/CTest/cmCTestRunScriptCommand.cxx
  8. 2 1
      Source/CTest/cmCTestRunScriptCommand.h
  9. 4 2
      Source/CTest/cmCTestScriptHandler.cxx
  10. 2 2
      Source/CTest/cmCTestSleepCommand.cxx
  11. 2 1
      Source/CTest/cmCTestSleepCommand.h
  12. 2 2
      Source/CTest/cmCTestStartCommand.cxx
  13. 2 1
      Source/CTest/cmCTestStartCommand.h
  14. 16 10
      Source/CTest/cmCTestTestHandler.cxx
  15. 2 2
      Source/cmAddCustomCommandCommand.cxx
  16. 2 1
      Source/cmAddCustomCommandCommand.h
  17. 2 2
      Source/cmAddCustomTargetCommand.cxx
  18. 2 1
      Source/cmAddCustomTargetCommand.h
  19. 2 2
      Source/cmAddDefinitionsCommand.cxx
  20. 2 1
      Source/cmAddDefinitionsCommand.h
  21. 2 2
      Source/cmAddDependenciesCommand.cxx
  22. 2 1
      Source/cmAddDependenciesCommand.h
  23. 2 1
      Source/cmAddExecutableCommand.cxx
  24. 2 1
      Source/cmAddExecutableCommand.h
  25. 2 1
      Source/cmAddLibraryCommand.cxx
  26. 2 1
      Source/cmAddLibraryCommand.h
  27. 1 1
      Source/cmAddSubDirectoryCommand.cxx
  28. 2 1
      Source/cmAddSubDirectoryCommand.h
  29. 2 1
      Source/cmAddTestCommand.cxx
  30. 2 1
      Source/cmAddTestCommand.h
  31. 1 1
      Source/cmAuxSourceDirectoryCommand.cxx
  32. 2 1
      Source/cmAuxSourceDirectoryCommand.h
  33. 4 0
      Source/cmBootstrapCommands.cxx
  34. 26 0
      Source/cmBreakCommand.cxx
  35. 78 0
      Source/cmBreakCommand.h
  36. 2 1
      Source/cmBuildCommand.cxx
  37. 2 1
      Source/cmBuildCommand.h
  38. 2 1
      Source/cmBuildNameCommand.cxx
  39. 2 1
      Source/cmBuildNameCommand.h
  40. 2 1
      Source/cmCMakeMinimumRequired.cxx
  41. 2 1
      Source/cmCMakeMinimumRequired.h
  42. 2 1
      Source/cmCPluginAPI.cxx
  43. 5 3
      Source/cmCommand.h
  44. 2 1
      Source/cmConfigureFileCommand.cxx
  45. 2 1
      Source/cmConfigureFileCommand.h
  46. 2 1
      Source/cmCreateTestSourceList.cxx
  47. 2 1
      Source/cmCreateTestSourceList.h
  48. 2 2
      Source/cmDefinePropertyCommand.cxx
  49. 2 1
      Source/cmDefinePropertyCommand.h
  50. 2 1
      Source/cmElseCommand.cxx
  51. 2 1
      Source/cmElseCommand.h
  52. 2 1
      Source/cmElseIfCommand.cxx
  53. 2 1
      Source/cmElseIfCommand.h
  54. 1 1
      Source/cmEnableLanguageCommand.cxx
  55. 2 1
      Source/cmEnableLanguageCommand.h
  56. 2 1
      Source/cmEnableTestingCommand.cxx
  57. 2 1
      Source/cmEnableTestingCommand.h
  58. 2 1
      Source/cmEndForEachCommand.cxx
  59. 4 2
      Source/cmEndForEachCommand.h
  60. 2 1
      Source/cmEndFunctionCommand.cxx
  61. 4 2
      Source/cmEndFunctionCommand.h
  62. 2 1
      Source/cmEndIfCommand.cxx
  63. 2 1
      Source/cmEndIfCommand.h
  64. 2 1
      Source/cmEndMacroCommand.cxx
  65. 4 2
      Source/cmEndMacroCommand.h
  66. 2 1
      Source/cmEndWhileCommand.cxx
  67. 4 2
      Source/cmEndWhileCommand.h
  68. 2 1
      Source/cmExecProgramCommand.cxx
  69. 2 1
      Source/cmExecProgramCommand.h
  70. 1 1
      Source/cmExecuteProcessCommand.cxx
  71. 2 1
      Source/cmExecuteProcessCommand.h
  72. 53 0
      Source/cmExecutionStatus.h
  73. 1 1
      Source/cmExportCommand.cxx
  74. 2 1
      Source/cmExportCommand.h
  75. 1 1
      Source/cmExportLibraryDependencies.cxx
  76. 2 1
      Source/cmExportLibraryDependencies.h
  77. 2 1
      Source/cmFLTKWrapUICommand.cxx
  78. 2 1
      Source/cmFLTKWrapUICommand.h
  79. 2 1
      Source/cmFileCommand.cxx
  80. 2 1
      Source/cmFileCommand.h
  81. 2 1
      Source/cmFindLibraryCommand.cxx
  82. 2 1
      Source/cmFindLibraryCommand.h
  83. 2 1
      Source/cmFindPackageCommand.cxx
  84. 2 1
      Source/cmFindPackageCommand.h
  85. 2 1
      Source/cmFindPathCommand.cxx
  86. 2 1
      Source/cmFindPathCommand.h
  87. 2 1
      Source/cmFindProgramCommand.cxx
  88. 2 1
      Source/cmFindProgramCommand.h
  89. 23 4
      Source/cmForEachCommand.cxx
  90. 4 2
      Source/cmForEachCommand.h
  91. 3 1
      Source/cmFunctionBlocker.h
  92. 17 6
      Source/cmFunctionCommand.cxx
  93. 5 2
      Source/cmFunctionCommand.h
  94. 2 2
      Source/cmGetCMakePropertyCommand.cxx
  95. 2 1
      Source/cmGetCMakePropertyCommand.h
  96. 2 2
      Source/cmGetDirectoryPropertyCommand.cxx
  97. 2 1
      Source/cmGetDirectoryPropertyCommand.h
  98. 1 1
      Source/cmGetFilenameComponentCommand.cxx
  99. 2 1
      Source/cmGetFilenameComponentCommand.h
  100. 2 1
      Source/cmGetPropertyCommand.cxx

+ 2 - 2
Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx

@@ -18,8 +18,8 @@
 
 #include "cmCTestScriptHandler.h"
 
-bool cmCTestEmptyBinaryDirectoryCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmCTestEmptyBinaryDirectoryCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() != 1 )
     {

+ 2 - 1
Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h

@@ -47,7 +47,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 2
Source/CTest/cmCTestHandlerCommand.cxx

@@ -35,8 +35,8 @@ cmCTestHandlerCommand::cmCTestHandlerCommand()
   this->Last = ct_LAST;
 }
 
-bool cmCTestHandlerCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmCTestHandlerCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if ( !this->ProcessArguments(args, (unsigned int)this->Last, 
                                &*this->Arguments.begin(),this->Values) )

+ 2 - 1
Source/CTest/cmCTestHandlerCommand.h

@@ -35,7 +35,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   cmTypeMacro(cmCTestHandlerCommand, cmCTestCommand);
 

+ 2 - 2
Source/CTest/cmCTestReadCustomFilesCommand.cxx

@@ -18,8 +18,8 @@
 
 #include "cmCTest.h"
 
-bool cmCTestReadCustomFilesCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmCTestReadCustomFilesCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if (args.size() < 1)
     {

+ 2 - 1
Source/CTest/cmCTestReadCustomFilesCommand.h

@@ -45,7 +45,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 2
Source/CTest/cmCTestRunScriptCommand.cxx

@@ -18,8 +18,8 @@
 
 #include "cmCTestScriptHandler.h"
 
-bool cmCTestRunScriptCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmCTestRunScriptCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 1 )
     {

+ 2 - 1
Source/CTest/cmCTestRunScriptCommand.h

@@ -46,7 +46,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 4 - 2
Source/CTest/cmCTestScriptHandler.cxx

@@ -65,7 +65,8 @@ public:
   cmCTestScriptFunctionBlocker() {}
   virtual ~cmCTestScriptFunctionBlocker() {}
   virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
-                                 cmMakefile &mf);
+                                 cmMakefile &mf,
+                                 cmExecutionStatus &);
   //virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf);
   //virtual void ScopeEnded(cmMakefile &mf);
 
@@ -74,7 +75,8 @@ public:
 
 // simply update the time and don't block anything
 bool cmCTestScriptFunctionBlocker::
-IsFunctionBlocked(const cmListFileFunction& , cmMakefile &)
+IsFunctionBlocked(const cmListFileFunction& , cmMakefile &,
+                  cmExecutionStatus &)
 {
   this->CTestScriptHandler->UpdateElapsedTime();
   return false;

+ 2 - 2
Source/CTest/cmCTestSleepCommand.cxx

@@ -19,8 +19,8 @@
 #include "cmCTestScriptHandler.h"
 #include <stdlib.h> // required for atoi
 
-bool cmCTestSleepCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmCTestSleepCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if (args.size() < 1)
     {

+ 2 - 1
Source/CTest/cmCTestSleepCommand.h

@@ -46,7 +46,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 2
Source/CTest/cmCTestStartCommand.cxx

@@ -20,8 +20,8 @@
 #include "cmLocalGenerator.h"
 #include "cmGlobalGenerator.h"
 
-bool cmCTestStartCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmCTestStartCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if (args.size() < 1)
     {

+ 2 - 1
Source/CTest/cmCTestStartCommand.h

@@ -45,7 +45,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 16 - 10
Source/CTest/cmCTestTestHandler.cxx

@@ -53,7 +53,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &);
 
   /**
    * The name of the command as specified in CMakeList.txt.
@@ -70,7 +71,8 @@ public:
 };
 
 //----------------------------------------------------------------------
-bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args)
+bool cmCTestSubdirCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 1 )
     {
@@ -139,7 +141,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &);
 
   /**
    * The name of the command as specified in CMakeList.txt.
@@ -157,7 +160,7 @@ public:
 
 //----------------------------------------------------------------------
 bool cmCTestAddSubdirectoryCommand
-::InitialPass(std::vector<std::string> const& args)
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 1 )
     {
@@ -223,7 +226,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const&);
+  virtual bool InitialPass(std::vector<std::string> const&,
+                           cmExecutionStatus &);
 
   /**
    * The name of the command as specified in CMakeList.txt.
@@ -240,7 +244,8 @@ public:
 };
 
 //----------------------------------------------------------------------
-bool cmCTestAddTestCommand::InitialPass(std::vector<std::string> const& args)
+bool cmCTestAddTestCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if ( args.size() < 2 )
     {
@@ -268,8 +273,9 @@ public:
   /**
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
-   */
-  virtual bool InitialPass(std::vector<std::string> const&);
+  */
+  virtual bool InitialPass(std::vector<std::string> const&,
+                           cmExecutionStatus &);
 
   /**
    * The name of the command as specified in CMakeList.txt.
@@ -286,8 +292,8 @@ public:
 };
 
 //----------------------------------------------------------------------
-bool cmCTestSetTestsPropertiesCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmCTestSetTestsPropertiesCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   return this->TestHandler->SetTestsProperties(args);
 }

+ 2 - 2
Source/cmAddCustomCommandCommand.cxx

@@ -21,8 +21,8 @@
 #include "cmSourceFile.h"
 
 // cmAddCustomCommandCommand
-bool cmAddCustomCommandCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmAddCustomCommandCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   /* Let's complain at the end of this function about the lack of a particular
      arg. For the moment, let's say that COMMAND, and either TARGET or SOURCE

+ 2 - 1
Source/cmAddCustomCommandCommand.h

@@ -42,7 +42,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 2
Source/cmAddCustomTargetCommand.cxx

@@ -17,8 +17,8 @@
 #include "cmAddCustomTargetCommand.h"
 
 // cmAddCustomTargetCommand
-bool cmAddCustomTargetCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmAddCustomTargetCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 1 )
     {

+ 2 - 1
Source/cmAddCustomTargetCommand.h

@@ -41,7 +41,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
   
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 2
Source/cmAddDefinitionsCommand.cxx

@@ -17,8 +17,8 @@
 #include "cmAddDefinitionsCommand.h"
 
 // cmAddDefinitionsCommand
-bool cmAddDefinitionsCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmAddDefinitionsCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   // it is OK to have no arguments
   if(args.size() < 1 )

+ 2 - 1
Source/cmAddDefinitionsCommand.h

@@ -40,7 +40,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 2
Source/cmAddDependenciesCommand.cxx

@@ -19,8 +19,8 @@
 #include "cmGlobalGenerator.h"
 
 // cmDependenciesCommand
-bool cmAddDependenciesCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmAddDependenciesCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 2 )
     {

+ 2 - 1
Source/cmAddDependenciesCommand.h

@@ -39,7 +39,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 1
Source/cmAddExecutableCommand.cxx

@@ -17,7 +17,8 @@
 #include "cmAddExecutableCommand.h"
 
 // cmExecutableCommand
-bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args)
+bool cmAddExecutableCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 2 )
     {

+ 2 - 1
Source/cmAddExecutableCommand.h

@@ -40,7 +40,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 1
Source/cmAddLibraryCommand.cxx

@@ -19,7 +19,8 @@
 #include "cmake.h"
 
 // cmLibraryCommand
-bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args)
+bool cmAddLibraryCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 1 )
     {

+ 2 - 1
Source/cmAddLibraryCommand.h

@@ -40,7 +40,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 1 - 1
Source/cmAddSubDirectoryCommand.cxx

@@ -18,7 +18,7 @@
 
 // cmAddSubDirectoryCommand
 bool cmAddSubDirectoryCommand::InitialPass
-(std::vector<std::string> const& args)
+(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 1 )
     {

+ 2 - 1
Source/cmAddSubDirectoryCommand.h

@@ -41,7 +41,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 1
Source/cmAddTestCommand.cxx

@@ -20,7 +20,8 @@
 
 
 // cmExecutableCommand
-bool cmAddTestCommand::InitialPass(std::vector<std::string> const& args)
+bool cmAddTestCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   // First argument is the name of the test Second argument is the name of
   // the executable to run (a target or external program) Remaining arguments

+ 2 - 1
Source/cmAddTestCommand.h

@@ -39,7 +39,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 1 - 1
Source/cmAuxSourceDirectoryCommand.cxx

@@ -21,7 +21,7 @@
 
 // cmAuxSourceDirectoryCommand
 bool cmAuxSourceDirectoryCommand::InitialPass
-(std::vector<std::string> const& args)
+(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 2 || args.size() > 2)
     {

+ 2 - 1
Source/cmAuxSourceDirectoryCommand.h

@@ -43,7 +43,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 4 - 0
Source/cmBootstrapCommands.cxx

@@ -27,6 +27,7 @@
 #include "cmAddLibraryCommand.cxx"
 #include "cmAddSubDirectoryCommand.cxx"
 #include "cmAddTestCommand.cxx"
+#include "cmBreakCommand.cxx"
 #include "cmBuildCommand.cxx"
 #include "cmCMakeMinimumRequired.cxx"
 #include "cmCommandArgumentsHelper.cxx"
@@ -70,6 +71,7 @@
 #include "cmMessageCommand.cxx"
 #include "cmOptionCommand.cxx"
 #include "cmProjectCommand.cxx"
+#include "cmReturnCommand.cxx"
 #include "cmSetCommand.cxx"
 #include "cmSetPropertyCommand.cxx"
 #include "cmSetSourceFilesPropertiesCommand.cxx"
@@ -92,6 +94,7 @@ void GetBootstrapCommands(std::list<cmCommand*>& commands)
   commands.push_back(new cmAddLibraryCommand);
   commands.push_back(new cmAddSubDirectoryCommand);
   commands.push_back(new cmAddTestCommand);
+  commands.push_back(new cmBreakCommand);
   commands.push_back(new cmBuildCommand);
   commands.push_back(new cmCMakeMinimumRequired);
   commands.push_back(new cmConfigureFileCommand);
@@ -129,6 +132,7 @@ void GetBootstrapCommands(std::list<cmCommand*>& commands)
   commands.push_back(new cmMessageCommand);
   commands.push_back(new cmOptionCommand);
   commands.push_back(new cmProjectCommand);
+  commands.push_back(new cmReturnCommand);
   commands.push_back(new cmSetCommand);
   commands.push_back(new cmSetPropertyCommand);
   commands.push_back(new cmSetSourceFilesPropertiesCommand);

+ 26 - 0
Source/cmBreakCommand.cxx

@@ -0,0 +1,26 @@
+/*=========================================================================
+
+  Program:   CMake - Cross-Platform Makefile Generator
+  Module:    $RCSfile$
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
+  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even 
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#include "cmBreakCommand.h"
+
+// cmBreakCommand
+bool cmBreakCommand::InitialPass(std::vector<std::string> const&,
+                                  cmExecutionStatus &status)
+{
+  status.SetBreakInvoked(true);
+  return true;
+}
+

+ 78 - 0
Source/cmBreakCommand.h

@@ -0,0 +1,78 @@
+/*=========================================================================
+
+  Program:   CMake - Cross-Platform Makefile Generator
+  Module:    $RCSfile$
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
+  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even 
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmBreakCommand_h
+#define cmBreakCommand_h
+
+#include "cmCommand.h"
+
+/** \class cmBreakCommand
+ * \brief Break from an enclosing foreach or while loop
+ *
+ * cmBreakCommand returns from an enclosing foreach or while loop
+ */
+class cmBreakCommand : public cmCommand
+{
+public:
+  /**
+   * This is a virtual constructor for the command.
+   */
+  virtual cmCommand* Clone() 
+    {
+    return new cmBreakCommand;
+    }
+
+  /**
+   * This is called when the command is first encountered in
+   * the CMakeLists.txt file.
+   */
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
+
+  /**
+   * This determines if the command is invoked when in script mode.
+   */
+  virtual bool IsScriptable() { return true; }
+
+  /**
+   * The name of the command as specified in CMakeList.txt.
+   */
+  virtual const char* GetName() {return "break";}
+  
+  /**
+   * Succinct documentation.
+   */
+  virtual const char* GetTerseDocumentation() 
+    {
+    return "Break from an enclosing foreach or while loop.";
+    }
+  
+  /**
+   * More documentation.
+   */
+  virtual const char* GetFullDocumentation()
+    {
+    return
+      "  break()\n"
+      "Breaks from an enclosing foreach loop or while loop";
+    }
+  
+  cmTypeMacro(cmBreakCommand, cmCommand);
+};
+
+
+
+#endif

+ 2 - 1
Source/cmBuildCommand.cxx

@@ -20,7 +20,8 @@
 #include "cmGlobalGenerator.h"
 
 // cmBuildCommand
-bool cmBuildCommand::InitialPass(std::vector<std::string> const& args)
+bool cmBuildCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 2 )
     {

+ 2 - 1
Source/cmBuildCommand.h

@@ -39,7 +39,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 1
Source/cmBuildNameCommand.cxx

@@ -19,7 +19,8 @@
 #include <cmsys/RegularExpression.hxx>
 
 // cmBuildNameCommand
-bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args)
+bool cmBuildNameCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 1 )
     {

+ 2 - 1
Source/cmBuildNameCommand.h

@@ -39,7 +39,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmCMakeMinimumRequired.cxx

@@ -19,7 +19,8 @@
 #include "cmVersion.h"
 
 // cmCMakeMinimumRequired
-bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> const& args)
+bool cmCMakeMinimumRequired
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   // Process arguments.
   std::string version_string;

+ 2 - 1
Source/cmCMakeMinimumRequired.h

@@ -39,7 +39,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmCPluginAPI.cxx

@@ -430,7 +430,8 @@ int CCONV cmExecuteCommand(void *arg, const char *name,
     lff.Arguments.push_back(cmListFileArgument(args[i], true,
                                                "[CMake-Plugin]", 0));
     }
-  return mf->ExecuteCommand(lff);
+  cmExecutionStatus status;
+  return mf->ExecuteCommand(lff,status);
 }
 
 void CCONV cmExpandSourceListArguments(void *arg,

+ 5 - 3
Source/cmCommand.h

@@ -60,18 +60,20 @@ public:
    * encountered in the CMakeLists.txt file.  It expands the command's
    * arguments and then invokes the InitialPass.
    */
-  virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args)
+  virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
+                                 cmExecutionStatus &status)
     {
     std::vector<std::string> expandedArguments;
     this->Makefile->ExpandArguments(args, expandedArguments);
-    return this->InitialPass(expandedArguments);
+    return this->InitialPass(expandedArguments,status);
     }
 
   /**
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args) = 0;
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &) = 0;
 
   /**
    * This is called at the end after all the information

+ 2 - 1
Source/cmConfigureFileCommand.cxx

@@ -19,7 +19,8 @@
 #include <cmsys/RegularExpression.hxx>
 
 // cmConfigureFileCommand
-bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args)
+bool cmConfigureFileCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 2 )
     {

+ 2 - 1
Source/cmConfigureFileCommand.h

@@ -33,7 +33,8 @@ public:
    * This is called when the command is first encountered in
    * the input file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 1
Source/cmCreateTestSourceList.cxx

@@ -18,7 +18,8 @@
 #include "cmSourceFile.h"
 
 // cmCreateTestSourceList
-bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args)
+bool cmCreateTestSourceList
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if (args.size() < 3)
     {

+ 2 - 1
Source/cmCreateTestSourceList.h

@@ -39,7 +39,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 2
Source/cmDefinePropertyCommand.cxx

@@ -18,8 +18,8 @@
 #include "cmake.h"
 
 // cmDefinePropertiesCommand
-bool cmDefinePropertyCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmDefinePropertyCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 5 )
     {

+ 2 - 1
Source/cmDefinePropertyCommand.h

@@ -31,7 +31,8 @@ public:
    * This is called when the command is first encountered in
    * the input file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 1
Source/cmElseCommand.cxx

@@ -16,7 +16,8 @@
 =========================================================================*/
 #include "cmElseCommand.h"
 
-bool cmElseCommand::InitialPass(std::vector<std::string> const&)
+bool cmElseCommand::InitialPass(std::vector<std::string> const&,
+                                cmExecutionStatus &)
 {
   this->SetError("An ELSE command was found outside of a proper "
                  "IF ENDIF structure. Or its arguments did not match "

+ 2 - 1
Source/cmElseCommand.h

@@ -39,7 +39,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmElseIfCommand.cxx

@@ -16,7 +16,8 @@
 =========================================================================*/
 #include "cmElseIfCommand.h"
 
-bool cmElseIfCommand::InitialPass(std::vector<std::string> const&)
+bool cmElseIfCommand::InitialPass(std::vector<std::string> const&,
+                                  cmExecutionStatus &)
 {
   this->SetError("An ELSEIF command was found outside of a proper "
                  "IF ENDIF structure.");

+ 2 - 1
Source/cmElseIfCommand.h

@@ -39,7 +39,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 1 - 1
Source/cmEnableLanguageCommand.cxx

@@ -18,7 +18,7 @@
 
 // cmEnableLanguageCommand
 bool cmEnableLanguageCommand
-::InitialPass(std::vector<std::string> const& args)
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   bool optional = false;
   std::vector<std::string> languages;

+ 2 - 1
Source/cmEnableLanguageCommand.h

@@ -42,7 +42,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
   
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 1
Source/cmEnableTestingCommand.cxx

@@ -19,7 +19,8 @@
 
 // we do this in the final pass so that we now the subdirs have all 
 // been defined
-bool cmEnableTestingCommand::InitialPass(std::vector<std::string> const&)
+bool cmEnableTestingCommand::InitialPass(std::vector<std::string> const&,
+                                         cmExecutionStatus &)
 {
   this->Makefile->AddDefinition("CMAKE_TESTING_ENABLED","1");
   return true;

+ 2 - 1
Source/cmEnableTestingCommand.h

@@ -47,7 +47,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const&);
+  virtual bool InitialPass(std::vector<std::string> const&,
+                           cmExecutionStatus &);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 2 - 1
Source/cmEndForEachCommand.cxx

@@ -17,7 +17,8 @@
 #include "cmEndForEachCommand.h"
 
 bool cmEndForEachCommand
-::InvokeInitialPass(std::vector<cmListFileArgument> const&)
+::InvokeInitialPass(std::vector<cmListFileArgument> const&, 
+                    cmExecutionStatus &)
 {
   this->SetError("An ENDFOREACH command was found outside of a proper "
                  "FOREACH ENDFOREACH structure. Or its arguments did "

+ 4 - 2
Source/cmEndForEachCommand.h

@@ -39,13 +39,15 @@ public:
    * Override cmCommand::InvokeInitialPass to get arguments before
    * expansion.
    */
-  virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&);
+  virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
+                                 cmExecutionStatus &);
   
   /**
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const&) {return false;}
+  virtual bool InitialPass(std::vector<std::string> const&,
+                           cmExecutionStatus &) {return false;}
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmEndFunctionCommand.cxx

@@ -17,7 +17,8 @@
 #include "cmEndFunctionCommand.h"
 
 bool cmEndFunctionCommand
-::InvokeInitialPass(std::vector<cmListFileArgument> const&)
+::InvokeInitialPass(std::vector<cmListFileArgument> const&,
+                    cmExecutionStatus &)
 {
   this->SetError("An ENDFUNCTION command was found outside of a proper "
                  "FUNCTION ENDFUNCTION structure. Or its arguments did not "

+ 4 - 2
Source/cmEndFunctionCommand.h

@@ -39,13 +39,15 @@ public:
    * Override cmCommand::InvokeInitialPass to get arguments before
    * expansion.
    */
-  virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&);
+  virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
+                                 cmExecutionStatus &);
   
   /**
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const&) {return false;}
+  virtual bool InitialPass(std::vector<std::string> const&,
+                           cmExecutionStatus &) {return false;}
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmEndIfCommand.cxx

@@ -16,7 +16,8 @@
 =========================================================================*/
 #include "cmEndIfCommand.h"
 #include <stdlib.h> // required for atof
-bool cmEndIfCommand::InitialPass(std::vector<std::string> const&)
+bool cmEndIfCommand::InitialPass(std::vector<std::string> const&,
+                                 cmExecutionStatus &)
 {
   const char* versionValue
     = this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");

+ 2 - 1
Source/cmEndIfCommand.h

@@ -39,7 +39,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmEndMacroCommand.cxx

@@ -17,7 +17,8 @@
 #include "cmEndMacroCommand.h"
 
 bool cmEndMacroCommand
-::InvokeInitialPass(std::vector<cmListFileArgument> const&)
+::InvokeInitialPass(std::vector<cmListFileArgument> const&,
+                    cmExecutionStatus &)
 {
   this->SetError("An ENDMACRO command was found outside of a proper "
                  "MACRO ENDMACRO structure. Or its arguments did not "

+ 4 - 2
Source/cmEndMacroCommand.h

@@ -39,13 +39,15 @@ public:
    * Override cmCommand::InvokeInitialPass to get arguments before
    * expansion.
    */
-  virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&);
+  virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
+                                 cmExecutionStatus &);
   
   /**
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const&) {return false;}
+  virtual bool InitialPass(std::vector<std::string> const&,
+                           cmExecutionStatus &) {return false;}
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmEndWhileCommand.cxx

@@ -17,7 +17,8 @@
 #include "cmEndWhileCommand.h"
 
 bool cmEndWhileCommand
-::InvokeInitialPass(std::vector<cmListFileArgument> const&)
+::InvokeInitialPass(std::vector<cmListFileArgument> const&,
+                    cmExecutionStatus &)
 {
   this->SetError("An ENDWHILE command was found outside of a proper "
                  "WHILE ENDWHILE structure. Or its arguments did not "

+ 4 - 2
Source/cmEndWhileCommand.h

@@ -39,13 +39,15 @@ public:
    * Override cmCommand::InvokeInitialPass to get arguments before
    * expansion.
    */
-  virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&);
+  virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&,
+                                 cmExecutionStatus &status);
   
   /**
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const&) {return false;}
+  virtual bool InitialPass(std::vector<std::string> const&,
+                           cmExecutionStatus &) {return false;}
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmExecProgramCommand.cxx

@@ -18,7 +18,8 @@
 #include "cmSystemTools.h"
 
 // cmExecProgramCommand
-bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args)
+bool cmExecProgramCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 1 )
     {

+ 2 - 1
Source/cmExecProgramCommand.h

@@ -41,7 +41,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
   
   /**
    * The name of the command as specified in CMakeList.txt.

+ 1 - 1
Source/cmExecuteProcessCommand.cxx

@@ -33,7 +33,7 @@ void cmExecuteProcessCommandAppend(std::vector<char>& output,
 
 // cmExecuteProcessCommand
 bool cmExecuteProcessCommand
-::InitialPass(std::vector<std::string> const& args)
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 1 )
     {

+ 2 - 1
Source/cmExecuteProcessCommand.h

@@ -40,7 +40,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 53 - 0
Source/cmExecutionStatus.h

@@ -0,0 +1,53 @@
+/*=========================================================================
+
+  Program:   CMake - Cross-Platform Makefile Generator
+  Module:    $RCSfile$
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+  Copyright (c) 2002 Kitware, Inc., Insight Consortium.  All rights reserved.
+  See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
+
+     This software is distributed WITHOUT ANY WARRANTY; without even 
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef cmExecutionStatus_h
+#define cmExecutionStatus_h
+
+#include "cmObject.h"
+
+/** \class cmExecutionStatus
+ * \brief Superclass for all command status classes
+ *
+ * when a command is involked it may set values on a command status instance
+ */
+class cmExecutionStatus : public cmObject
+{
+public:
+  cmTypeMacro(cmExecutionStatus, cmObject);
+  
+  cmExecutionStatus() { this->Clear();};
+  
+  virtual void SetReturnInvoked(bool val) 
+  { this->ReturnInvoked = val; }
+  virtual bool GetReturnInvoked()
+  { return this->ReturnInvoked; }
+                                 
+  virtual void SetBreakInvoked(bool val) 
+  { this->BreakInvoked = val; }
+  virtual bool GetBreakInvoked()
+  { return this->BreakInvoked; }
+            
+  virtual void Clear()
+  { this->ReturnInvoked = false; this->BreakInvoked = false; }
+
+                                        
+protected:
+  bool ReturnInvoked;
+  bool BreakInvoked;
+};
+
+#endif

+ 1 - 1
Source/cmExportCommand.cxx

@@ -39,7 +39,7 @@ cmExportCommand::cmExportCommand()
 
 // cmExportCommand
 bool cmExportCommand
-::InitialPass(std::vector<std::string> const& args)
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 2 )
     {

+ 2 - 1
Source/cmExportCommand.h

@@ -41,7 +41,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * The name of the command as specified in CMakeList.txt.

+ 1 - 1
Source/cmExportLibraryDependencies.cxx

@@ -23,7 +23,7 @@
 #include <cmsys/auto_ptr.hxx>
 
 bool cmExportLibraryDependenciesCommand
-::InitialPass(std::vector<std::string> const& args)
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 1 )
     {

+ 2 - 1
Source/cmExportLibraryDependencies.h

@@ -40,7 +40,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This is called at the end after all the information

+ 2 - 1
Source/cmFLTKWrapUICommand.cxx

@@ -19,7 +19,8 @@
 #include "cmSourceFile.h"
 
 // cmFLTKWrapUICommand
-bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args)
+bool cmFLTKWrapUICommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 2 )
     {

+ 2 - 1
Source/cmFLTKWrapUICommand.h

@@ -42,7 +42,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
   
   /**
    * This is called at the end after all the information

+ 2 - 1
Source/cmFileCommand.cxx

@@ -54,7 +54,8 @@ static mode_t mode_setgid = S_ISGID;
 #endif
 
 // cmLibraryCommand
-bool cmFileCommand::InitialPass(std::vector<std::string> const& args)
+bool cmFileCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 2 )
     {

+ 2 - 1
Source/cmFileCommand.h

@@ -40,7 +40,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmFindLibraryCommand.cxx

@@ -55,7 +55,8 @@ cmFindLibraryCommand::cmFindLibraryCommand()
 }
 
 // cmFindLibraryCommand
-bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn)
+bool cmFindLibraryCommand
+::InitialPass(std::vector<std::string> const& argsIn, cmExecutionStatus &)
 {
   this->VariableDocumentation = "Path to a library.";
   this->CMakePathName = "LIBRARY";

+ 2 - 1
Source/cmFindLibraryCommand.h

@@ -43,7 +43,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmFindPackageCommand.cxx

@@ -231,7 +231,8 @@ const char* cmFindPackageCommand::GetFullDocumentation()
 }
 
 //----------------------------------------------------------------------------
-bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args)
+bool cmFindPackageCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 1)
     {

+ 2 - 1
Source/cmFindPackageCommand.h

@@ -43,7 +43,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmFindPathCommand.cxx

@@ -70,7 +70,8 @@ const char* cmFindPathCommand::GetFullDocumentation()
 }
 
 // cmFindPathCommand
-bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
+bool cmFindPathCommand
+::InitialPass(std::vector<std::string> const& argsIn, cmExecutionStatus &)
 {
   this->VariableDocumentation = "Path to a file.";
   this->CMakePathName = "INCLUDE";

+ 2 - 1
Source/cmFindPathCommand.h

@@ -43,7 +43,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmFindProgramCommand.cxx

@@ -51,7 +51,8 @@ cmFindProgramCommand::cmFindProgramCommand()
 }
 
 // cmFindProgramCommand
-bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn)
+bool cmFindProgramCommand
+::InitialPass(std::vector<std::string> const& argsIn, cmExecutionStatus &)
 {
   this->VariableDocumentation = "Path to a program.";
   this->CMakePathName = "PROGRAM";

+ 2 - 1
Source/cmFindProgramCommand.h

@@ -43,7 +43,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 23 - 4
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)
     {

+ 4 - 2
Source/cmForEachCommand.h

@@ -32,7 +32,8 @@ public:
   cmForEachFunctionBlocker() {this->Executing = false; Depth = 0;}
   virtual ~cmForEachFunctionBlocker() {}
   virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
-                                 cmMakefile &mf);
+                                 cmMakefile &mf,
+                                 cmExecutionStatus &);
   virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf);
   virtual void ScopeEnded(cmMakefile &mf);
   
@@ -63,7 +64,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 3 - 1
Source/cmFunctionBlocker.h

@@ -18,6 +18,7 @@
 #define cmFunctionBlocker_h
 
 #include "cmStandardIncludes.h"
+#include "cmExecutionStatus.h"
 class cmMakefile;
 
 /** \class cmFunctionBlocker
@@ -32,7 +33,8 @@ public:
    * should a function be blocked
    */
   virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
-                                 cmMakefile&mf) = 0;
+                                 cmMakefile&mf,
+                                 cmExecutionStatus &status) = 0;
 
   /**
    * should this function blocker be removed, useful when one function adds a

+ 17 - 6
Source/cmFunctionCommand.cxx

@@ -48,9 +48,11 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args);
+  virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
+                                 cmExecutionStatus &);
 
-  virtual bool InitialPass(std::vector<std::string> const&) { return false; };
+  virtual bool InitialPass(std::vector<std::string> const&,
+                           cmExecutionStatus &) { return false; };
 
   /**
    * The name of the command as specified in CMakeList.txt.
@@ -83,7 +85,8 @@ public:
 
 
 bool cmFunctionHelperCommand::InvokeInitialPass
-(const std::vector<cmListFileArgument>& args)
+(const std::vector<cmListFileArgument>& args,
+ cmExecutionStatus &)
 {
   // Expand the argument list to the function.
   std::vector<std::string> expandedArgs;
@@ -153,7 +156,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass
   // for each function
   for(unsigned int c = 0; c < this->Functions.size(); ++c)
     {
-    if (!this->Makefile->ExecuteCommand(this->Functions[c]))
+    cmExecutionStatus status;
+    if (!this->Makefile->ExecuteCommand(this->Functions[c],status))
       {
       cmOStringStream error;
       error << "Error in cmake code at\n"
@@ -167,6 +171,11 @@ bool cmFunctionHelperCommand::InvokeInitialPass
       this->Makefile->PopScope();
       return false;
       }
+    if (status.GetReturnInvoked())
+      {
+      this->Makefile->PopScope();
+      return true;
+      }
     }
 
   // pop scope on the makefile
@@ -175,7 +184,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass
 }
 
 bool cmFunctionFunctionBlocker::
-IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
+IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
+                  cmExecutionStatus &)
 {
   // record commands until we hit the ENDFUNCTION
   // at the ENDFUNCTION call we shift gears and start looking for invocations
@@ -266,7 +276,8 @@ ScopeEnded(cmMakefile &mf)
     this->Args[0].c_str());
 }
 
-bool cmFunctionCommand::InitialPass(std::vector<std::string> const& args)
+bool cmFunctionCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 1)
     {

+ 5 - 2
Source/cmFunctionCommand.h

@@ -30,7 +30,9 @@ class cmFunctionFunctionBlocker : public cmFunctionBlocker
 public:
   cmFunctionFunctionBlocker() {this->Depth=0;}
   virtual ~cmFunctionFunctionBlocker() {}
-  virtual bool IsFunctionBlocked(const cmListFileFunction&, cmMakefile &mf);
+  virtual bool IsFunctionBlocked(const cmListFileFunction&, 
+                                 cmMakefile &mf,
+                                 cmExecutionStatus &);
   virtual bool ShouldRemove(const cmListFileFunction&, cmMakefile &mf);
   virtual void ScopeEnded(cmMakefile &mf);
   
@@ -59,7 +61,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 2
Source/cmGetCMakePropertyCommand.cxx

@@ -19,8 +19,8 @@
 #include "cmake.h"
 
 // cmGetCMakePropertyCommand
-bool cmGetCMakePropertyCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmGetCMakePropertyCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 2 )
     {

+ 2 - 1
Source/cmGetCMakePropertyCommand.h

@@ -31,7 +31,8 @@ public:
    * This is called when the command is first encountered in
    * the input file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 2
Source/cmGetDirectoryPropertyCommand.cxx

@@ -19,8 +19,8 @@
 #include "cmake.h"
 
 // cmGetDirectoryPropertyCommand
-bool cmGetDirectoryPropertyCommand::InitialPass(
-  std::vector<std::string> const& args)
+bool cmGetDirectoryPropertyCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 2 )
     {

+ 2 - 1
Source/cmGetDirectoryPropertyCommand.h

@@ -31,7 +31,8 @@ public:
    * This is called when the command is first encountered in
    * the input file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 1 - 1
Source/cmGetFilenameComponentCommand.cxx

@@ -19,7 +19,7 @@
 
 // cmGetFilenameComponentCommand
 bool cmGetFilenameComponentCommand
-::InitialPass(std::vector<std::string> const& args)
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 3)
     {

+ 2 - 1
Source/cmGetFilenameComponentCommand.h

@@ -40,7 +40,8 @@ public:
    * This is called when the command is first encountered in
    * the CMakeLists.txt file.
    */
-  virtual bool InitialPass(std::vector<std::string> const& args);
+  virtual bool InitialPass(std::vector<std::string> const& args,
+                           cmExecutionStatus &status);
 
   /**
    * This determines if the command is invoked when in script mode.

+ 2 - 1
Source/cmGetPropertyCommand.cxx

@@ -27,7 +27,8 @@ cmGetPropertyCommand::cmGetPropertyCommand()
 }
 
 //----------------------------------------------------------------------------
-bool cmGetPropertyCommand::InitialPass(std::vector<std::string> const& args)
+bool cmGetPropertyCommand
+::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
   if(args.size() < 3 )
     {

Some files were not shown because too many files changed in this diff