From 0e69d38004787f1d55eb7188cde4cf45e0a3957d Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Wed, 23 Jan 2008 10:28:26 -0500 Subject: [PATCH] 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 --- .../cmCTestEmptyBinaryDirectoryCommand.cxx | 4 +- .../cmCTestEmptyBinaryDirectoryCommand.h | 3 +- Source/CTest/cmCTestHandlerCommand.cxx | 4 +- Source/CTest/cmCTestHandlerCommand.h | 3 +- .../CTest/cmCTestReadCustomFilesCommand.cxx | 4 +- Source/CTest/cmCTestReadCustomFilesCommand.h | 3 +- Source/CTest/cmCTestRunScriptCommand.cxx | 4 +- Source/CTest/cmCTestRunScriptCommand.h | 3 +- Source/CTest/cmCTestScriptHandler.cxx | 6 +- Source/CTest/cmCTestSleepCommand.cxx | 4 +- Source/CTest/cmCTestSleepCommand.h | 3 +- Source/CTest/cmCTestStartCommand.cxx | 4 +- Source/CTest/cmCTestStartCommand.h | 3 +- Source/CTest/cmCTestTestHandler.cxx | 26 +-- Source/cmAddCustomCommandCommand.cxx | 4 +- Source/cmAddCustomCommandCommand.h | 3 +- Source/cmAddCustomTargetCommand.cxx | 4 +- Source/cmAddCustomTargetCommand.h | 3 +- Source/cmAddDefinitionsCommand.cxx | 4 +- Source/cmAddDefinitionsCommand.h | 3 +- Source/cmAddDependenciesCommand.cxx | 4 +- Source/cmAddDependenciesCommand.h | 3 +- Source/cmAddExecutableCommand.cxx | 3 +- Source/cmAddExecutableCommand.h | 3 +- Source/cmAddLibraryCommand.cxx | 3 +- Source/cmAddLibraryCommand.h | 3 +- Source/cmAddSubDirectoryCommand.cxx | 2 +- Source/cmAddSubDirectoryCommand.h | 3 +- Source/cmAddTestCommand.cxx | 3 +- Source/cmAddTestCommand.h | 3 +- Source/cmAuxSourceDirectoryCommand.cxx | 2 +- Source/cmAuxSourceDirectoryCommand.h | 3 +- Source/cmBootstrapCommands.cxx | 4 + Source/cmBreakCommand.cxx | 26 +++ Source/cmBreakCommand.h | 78 +++++++++ Source/cmBuildCommand.cxx | 3 +- Source/cmBuildCommand.h | 3 +- Source/cmBuildNameCommand.cxx | 3 +- Source/cmBuildNameCommand.h | 3 +- Source/cmCMakeMinimumRequired.cxx | 3 +- Source/cmCMakeMinimumRequired.h | 3 +- Source/cmCPluginAPI.cxx | 3 +- Source/cmCommand.h | 8 +- Source/cmConfigureFileCommand.cxx | 3 +- Source/cmConfigureFileCommand.h | 3 +- Source/cmCreateTestSourceList.cxx | 3 +- Source/cmCreateTestSourceList.h | 3 +- Source/cmDefinePropertyCommand.cxx | 4 +- Source/cmDefinePropertyCommand.h | 3 +- Source/cmElseCommand.cxx | 3 +- Source/cmElseCommand.h | 3 +- Source/cmElseIfCommand.cxx | 3 +- Source/cmElseIfCommand.h | 3 +- Source/cmEnableLanguageCommand.cxx | 2 +- Source/cmEnableLanguageCommand.h | 3 +- Source/cmEnableTestingCommand.cxx | 3 +- Source/cmEnableTestingCommand.h | 3 +- Source/cmEndForEachCommand.cxx | 3 +- Source/cmEndForEachCommand.h | 6 +- Source/cmEndFunctionCommand.cxx | 3 +- Source/cmEndFunctionCommand.h | 6 +- Source/cmEndIfCommand.cxx | 3 +- Source/cmEndIfCommand.h | 3 +- Source/cmEndMacroCommand.cxx | 3 +- Source/cmEndMacroCommand.h | 6 +- Source/cmEndWhileCommand.cxx | 3 +- Source/cmEndWhileCommand.h | 6 +- Source/cmExecProgramCommand.cxx | 3 +- Source/cmExecProgramCommand.h | 3 +- Source/cmExecuteProcessCommand.cxx | 2 +- Source/cmExecuteProcessCommand.h | 3 +- Source/cmExecutionStatus.h | 53 ++++++ Source/cmExportCommand.cxx | 2 +- Source/cmExportCommand.h | 3 +- Source/cmExportLibraryDependencies.cxx | 2 +- Source/cmExportLibraryDependencies.h | 3 +- Source/cmFLTKWrapUICommand.cxx | 3 +- Source/cmFLTKWrapUICommand.h | 3 +- Source/cmFileCommand.cxx | 3 +- Source/cmFileCommand.h | 3 +- Source/cmFindLibraryCommand.cxx | 3 +- Source/cmFindLibraryCommand.h | 3 +- Source/cmFindPackageCommand.cxx | 3 +- Source/cmFindPackageCommand.h | 3 +- Source/cmFindPathCommand.cxx | 3 +- Source/cmFindPathCommand.h | 3 +- Source/cmFindProgramCommand.cxx | 3 +- Source/cmFindProgramCommand.h | 3 +- Source/cmForEachCommand.cxx | 27 ++- Source/cmForEachCommand.h | 6 +- Source/cmFunctionBlocker.h | 4 +- Source/cmFunctionCommand.cxx | 23 ++- Source/cmFunctionCommand.h | 7 +- Source/cmGetCMakePropertyCommand.cxx | 4 +- Source/cmGetCMakePropertyCommand.h | 3 +- Source/cmGetDirectoryPropertyCommand.cxx | 4 +- Source/cmGetDirectoryPropertyCommand.h | 3 +- Source/cmGetFilenameComponentCommand.cxx | 2 +- Source/cmGetFilenameComponentCommand.h | 3 +- Source/cmGetPropertyCommand.cxx | 3 +- Source/cmGetPropertyCommand.h | 3 +- Source/cmGetSourceFilePropertyCommand.cxx | 4 +- Source/cmGetSourceFilePropertyCommand.h | 3 +- Source/cmGetTargetPropertyCommand.cxx | 4 +- Source/cmGetTargetPropertyCommand.h | 3 +- Source/cmGetTestPropertyCommand.cxx | 4 +- Source/cmGetTestPropertyCommand.h | 3 +- Source/cmIfCommand.cxx | 165 +++++++++++------- Source/cmIfCommand.h | 14 +- Source/cmIncludeCommand.cxx | 3 +- Source/cmIncludeCommand.h | 3 +- Source/cmIncludeDirectoryCommand.cxx | 2 +- Source/cmIncludeDirectoryCommand.h | 3 +- Source/cmIncludeExternalMSProjectCommand.cxx | 2 +- Source/cmIncludeExternalMSProjectCommand.h | 3 +- Source/cmIncludeRegularExpressionCommand.cxx | 2 +- Source/cmIncludeRegularExpressionCommand.h | 3 +- Source/cmInstallCommand.cxx | 3 +- Source/cmInstallCommand.h | 3 +- Source/cmInstallFilesCommand.cxx | 2 +- Source/cmInstallFilesCommand.h | 3 +- Source/cmInstallProgramsCommand.cxx | 2 +- Source/cmInstallProgramsCommand.h | 3 +- Source/cmInstallTargetsCommand.cxx | 2 +- Source/cmInstallTargetsCommand.h | 3 +- Source/cmLinkDirectoriesCommand.cxx | 2 +- Source/cmLinkDirectoriesCommand.h | 3 +- Source/cmLinkLibrariesCommand.cxx | 3 +- Source/cmLinkLibrariesCommand.h | 3 +- Source/cmListCommand.cxx | 3 +- Source/cmListCommand.h | 3 +- Source/cmLoadCacheCommand.cxx | 3 +- Source/cmLoadCacheCommand.h | 3 +- Source/cmLoadCommandCommand.cxx | 9 +- Source/cmLoadCommandCommand.h | 3 +- Source/cmMacroCommand.cxx | 28 ++- Source/cmMacroCommand.h | 7 +- Source/cmMakeDirectoryCommand.cxx | 3 +- Source/cmMakeDirectoryCommand.h | 3 +- Source/cmMakefile.cxx | 22 ++- Source/cmMakefile.h | 15 +- Source/cmMarkAsAdvancedCommand.cxx | 2 +- Source/cmMarkAsAdvancedCommand.h | 3 +- Source/cmMathCommand.cxx | 3 +- Source/cmMathCommand.h | 3 +- Source/cmMessageCommand.cxx | 3 +- Source/cmMessageCommand.h | 3 +- Source/cmOptionCommand.cxx | 3 +- Source/cmOptionCommand.h | 3 +- Source/cmOutputRequiredFilesCommand.cxx | 34 ++-- Source/cmOutputRequiredFilesCommand.h | 5 +- Source/cmProjectCommand.cxx | 3 +- Source/cmProjectCommand.h | 3 +- Source/cmQTWrapCPPCommand.cxx | 3 +- Source/cmQTWrapCPPCommand.h | 3 +- Source/cmQTWrapUICommand.cxx | 3 +- Source/cmQTWrapUICommand.h | 3 +- Source/cmRemoveCommand.cxx | 3 +- Source/cmRemoveCommand.h | 3 +- Source/cmRemoveDefinitionsCommand.cxx | 2 +- Source/cmRemoveDefinitionsCommand.h | 3 +- Source/cmReturnCommand.cxx | 26 +++ Source/cmReturnCommand.h | 82 +++++++++ Source/cmSeparateArgumentsCommand.cxx | 2 +- Source/cmSeparateArgumentsCommand.h | 3 +- Source/cmSetCommand.cxx | 3 +- Source/cmSetCommand.h | 3 +- Source/cmSetDirectoryPropertiesCommand.cxx | 4 +- Source/cmSetDirectoryPropertiesCommand.h | 3 +- Source/cmSetPropertyCommand.cxx | 3 +- Source/cmSetPropertyCommand.h | 3 +- Source/cmSetSourceFilesPropertiesCommand.cxx | 4 +- Source/cmSetSourceFilesPropertiesCommand.h | 3 +- Source/cmSetTargetPropertiesCommand.cxx | 4 +- Source/cmSetTargetPropertiesCommand.h | 3 +- Source/cmSetTestsPropertiesCommand.cxx | 4 +- Source/cmSetTestsPropertiesCommand.h | 3 +- Source/cmSiteNameCommand.cxx | 3 +- Source/cmSiteNameCommand.h | 3 +- Source/cmSourceGroupCommand.cxx | 3 +- Source/cmSourceGroupCommand.h | 3 +- Source/cmStringCommand.cxx | 3 +- Source/cmStringCommand.h | 3 +- Source/cmSubdirCommand.cxx | 3 +- Source/cmSubdirCommand.h | 3 +- Source/cmSubdirDependsCommand.cxx | 3 +- Source/cmSubdirDependsCommand.h | 3 +- Source/cmTargetLinkLibrariesCommand.cxx | 4 +- Source/cmTargetLinkLibrariesCommand.h | 3 +- Source/cmTryCompileCommand.cxx | 3 +- Source/cmTryCompileCommand.h | 3 +- Source/cmTryRunCommand.cxx | 5 +- Source/cmTryRunCommand.h | 3 +- Source/cmUseMangledMesaCommand.cxx | 2 +- Source/cmUseMangledMesaCommand.h | 3 +- Source/cmUtilitySourceCommand.cxx | 3 +- Source/cmUtilitySourceCommand.h | 3 +- Source/cmVariableRequiresCommand.cxx | 4 +- Source/cmVariableRequiresCommand.h | 3 +- Source/cmVariableWatchCommand.cxx | 6 +- Source/cmVariableWatchCommand.h | 3 +- Source/cmWhileCommand.cxx | 22 ++- Source/cmWhileCommand.h | 9 +- Source/cmWriteFileCommand.cxx | 3 +- Source/cmWriteFileCommand.h | 3 +- 205 files changed, 907 insertions(+), 360 deletions(-) create mode 100644 Source/cmBreakCommand.cxx create mode 100644 Source/cmBreakCommand.h create mode 100644 Source/cmExecutionStatus.h create mode 100644 Source/cmReturnCommand.cxx create mode 100644 Source/cmReturnCommand.h diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx index 57846568e..02da48585 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx @@ -18,8 +18,8 @@ #include "cmCTestScriptHandler.h" -bool cmCTestEmptyBinaryDirectoryCommand::InitialPass( - std::vector const& args) +bool cmCTestEmptyBinaryDirectoryCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() != 1 ) { diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h index f6bd9a3a8..0586bb044 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index da53d3401..56baab60f 100644 --- a/Source/CTest/cmCTestHandlerCommand.cxx +++ b/Source/CTest/cmCTestHandlerCommand.cxx @@ -35,8 +35,8 @@ cmCTestHandlerCommand::cmCTestHandlerCommand() this->Last = ct_LAST; } -bool cmCTestHandlerCommand::InitialPass( - std::vector const& args) +bool cmCTestHandlerCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if ( !this->ProcessArguments(args, (unsigned int)this->Last, &*this->Arguments.begin(),this->Values) ) diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h index 69563e1b9..727437b41 100644 --- a/Source/CTest/cmCTestHandlerCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); cmTypeMacro(cmCTestHandlerCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.cxx b/Source/CTest/cmCTestReadCustomFilesCommand.cxx index 88d9b8766..4feda8922 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.cxx +++ b/Source/CTest/cmCTestReadCustomFilesCommand.cxx @@ -18,8 +18,8 @@ #include "cmCTest.h" -bool cmCTestReadCustomFilesCommand::InitialPass( - std::vector const& args) +bool cmCTestReadCustomFilesCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if (args.size() < 1) { diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index cb870af6a..dd23d4101 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx index abb2e48cf..e01994dde 100644 --- a/Source/CTest/cmCTestRunScriptCommand.cxx +++ b/Source/CTest/cmCTestRunScriptCommand.cxx @@ -18,8 +18,8 @@ #include "cmCTestScriptHandler.h" -bool cmCTestRunScriptCommand::InitialPass( - std::vector const& args) +bool cmCTestRunScriptCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index 949cb77e0..6a26567b5 100644 --- a/Source/CTest/cmCTestRunScriptCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index c30e2818e..40926adbd 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/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; diff --git a/Source/CTest/cmCTestSleepCommand.cxx b/Source/CTest/cmCTestSleepCommand.cxx index 11108e82b..56747a88b 100644 --- a/Source/CTest/cmCTestSleepCommand.cxx +++ b/Source/CTest/cmCTestSleepCommand.cxx @@ -19,8 +19,8 @@ #include "cmCTestScriptHandler.h" #include // required for atoi -bool cmCTestSleepCommand::InitialPass( - std::vector const& args) +bool cmCTestSleepCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if (args.size() < 1) { diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index 37a6c8819..dcc102668 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 01b48c226..2e20632c8 100644 --- a/Source/CTest/cmCTestStartCommand.cxx +++ b/Source/CTest/cmCTestStartCommand.cxx @@ -20,8 +20,8 @@ #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" -bool cmCTestStartCommand::InitialPass( - std::vector const& args) +bool cmCTestStartCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if (args.size() < 1) { diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index 3962d039e..103a14b09 100644 --- a/Source/CTest/cmCTestStartCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 57edc9dbc..b01535fcd 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &); /** * The name of the command as specified in CMakeList.txt. @@ -70,7 +71,8 @@ public: }; //---------------------------------------------------------------------- -bool cmCTestSubdirCommand::InitialPass(std::vector const& args) +bool cmCTestSubdirCommand +::InitialPass(std::vector 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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &); /** * The name of the command as specified in CMakeList.txt. @@ -157,7 +160,7 @@ public: //---------------------------------------------------------------------- bool cmCTestAddSubdirectoryCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector 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 const&); + virtual bool InitialPass(std::vector const&, + cmExecutionStatus &); /** * The name of the command as specified in CMakeList.txt. @@ -240,7 +244,8 @@ public: }; //---------------------------------------------------------------------- -bool cmCTestAddTestCommand::InitialPass(std::vector const& args) +bool cmCTestAddTestCommand +::InitialPass(std::vector 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 const&); + */ + virtual bool InitialPass(std::vector const&, + cmExecutionStatus &); /** * The name of the command as specified in CMakeList.txt. @@ -286,8 +292,8 @@ public: }; //---------------------------------------------------------------------- -bool cmCTestSetTestsPropertiesCommand::InitialPass( - std::vector const& args) +bool cmCTestSetTestsPropertiesCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { return this->TestHandler->SetTestsProperties(args); } diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 6bff7c107..3161ef17d 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -21,8 +21,8 @@ #include "cmSourceFile.h" // cmAddCustomCommandCommand -bool cmAddCustomCommandCommand::InitialPass( - std::vector const& args) +bool cmAddCustomCommandCommand +::InitialPass(std::vector 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 diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index 31dc2ac74..14688942c 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 1bd6757b3..dfb9b0ce4 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -17,8 +17,8 @@ #include "cmAddCustomTargetCommand.h" // cmAddCustomTargetCommand -bool cmAddCustomTargetCommand::InitialPass( - std::vector const& args) +bool cmAddCustomTargetCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h index f9da05443..c988e6372 100644 --- a/Source/cmAddCustomTargetCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddDefinitionsCommand.cxx b/Source/cmAddDefinitionsCommand.cxx index d84f9142c..569ae70b9 100644 --- a/Source/cmAddDefinitionsCommand.cxx +++ b/Source/cmAddDefinitionsCommand.cxx @@ -17,8 +17,8 @@ #include "cmAddDefinitionsCommand.h" // cmAddDefinitionsCommand -bool cmAddDefinitionsCommand::InitialPass( - std::vector const& args) +bool cmAddDefinitionsCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { // it is OK to have no arguments if(args.size() < 1 ) diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h index ec35fe223..8e04704ad 100644 --- a/Source/cmAddDefinitionsCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index 1b2f8c648..eccf7d688 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -19,8 +19,8 @@ #include "cmGlobalGenerator.h" // cmDependenciesCommand -bool cmAddDependenciesCommand::InitialPass( - std::vector const& args) +bool cmAddDependenciesCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index 3c8147b26..d876e7c79 100644 --- a/Source/cmAddDependenciesCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index bc6a2c417..9914e171d 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -17,7 +17,8 @@ #include "cmAddExecutableCommand.h" // cmExecutableCommand -bool cmAddExecutableCommand::InitialPass(std::vector const& args) +bool cmAddExecutableCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h index 5f4383a71..daedc82ab 100644 --- a/Source/cmAddExecutableCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 36d636b56..4cc7e7ae3 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -19,7 +19,8 @@ #include "cmake.h" // cmLibraryCommand -bool cmAddLibraryCommand::InitialPass(std::vector const& args) +bool cmAddLibraryCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index e9d8f2f07..6b0f7a494 100644 --- a/Source/cmAddLibraryCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 72f5c51ce..00236e620 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -18,7 +18,7 @@ // cmAddSubDirectoryCommand bool cmAddSubDirectoryCommand::InitialPass -(std::vector const& args) +(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h index ca09858e2..813f30bca 100644 --- a/Source/cmAddSubDirectoryCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx index cf50401c0..6124ee2af 100644 --- a/Source/cmAddTestCommand.cxx +++ b/Source/cmAddTestCommand.cxx @@ -20,7 +20,8 @@ // cmExecutableCommand -bool cmAddTestCommand::InitialPass(std::vector const& args) +bool cmAddTestCommand +::InitialPass(std::vector 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 diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index 22f441240..84e75d921 100644 --- a/Source/cmAddTestCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index 321dcef96..1fc3467fd 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -21,7 +21,7 @@ // cmAuxSourceDirectoryCommand bool cmAuxSourceDirectoryCommand::InitialPass -(std::vector const& args) +(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 || args.size() > 2) { diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h index 538a8e844..f62bfd6cc 100644 --- a/Source/cmAuxSourceDirectoryCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx index b713549b6..ac1471de1 100644 --- a/Source/cmBootstrapCommands.cxx +++ b/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& 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& 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); diff --git a/Source/cmBreakCommand.cxx b/Source/cmBreakCommand.cxx new file mode 100644 index 000000000..8647ce562 --- /dev/null +++ b/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 const&, + cmExecutionStatus &status) +{ + status.SetBreakInvoked(true); + return true; +} + diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h new file mode 100644 index 000000000..010e18d25 --- /dev/null +++ b/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 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 diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index fd3760c5e..9977b1d8d 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -20,7 +20,8 @@ #include "cmGlobalGenerator.h" // cmBuildCommand -bool cmBuildCommand::InitialPass(std::vector const& args) +bool cmBuildCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h index 049d6543b..b2c6b22fd 100644 --- a/Source/cmBuildCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index 362c88f91..76d5bd5bd 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -19,7 +19,8 @@ #include // cmBuildNameCommand -bool cmBuildNameCommand::InitialPass(std::vector const& args) +bool cmBuildNameCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index c60fc19d0..578f02750 100644 --- a/Source/cmBuildNameCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index f9ddd5742..9a1417f9c 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -19,7 +19,8 @@ #include "cmVersion.h" // cmCMakeMinimumRequired -bool cmCMakeMinimumRequired::InitialPass(std::vector const& args) +bool cmCMakeMinimumRequired +::InitialPass(std::vector const& args, cmExecutionStatus &) { // Process arguments. std::string version_string; diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index 736e4878d..0fdd40866 100644 --- a/Source/cmCMakeMinimumRequired.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index e57519b50..04257cb3b 100644 --- a/Source/cmCPluginAPI.cxx +++ b/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, diff --git a/Source/cmCommand.h b/Source/cmCommand.h index 3111d46f8..e7c0fc67c 100644 --- a/Source/cmCommand.h +++ b/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& args) + virtual bool InvokeInitialPass(const std::vector& args, + cmExecutionStatus &status) { std::vector 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 const& args) = 0; + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &) = 0; /** * This is called at the end after all the information diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index aa337e503..2a8d3a4d1 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -19,7 +19,8 @@ #include // cmConfigureFileCommand -bool cmConfigureFileCommand::InitialPass(std::vector const& args) +bool cmConfigureFileCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index 78485cd3b..e35730a4b 100644 --- a/Source/cmConfigureFileCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 4d542c9d9..e3fb4ecc2 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -18,7 +18,8 @@ #include "cmSourceFile.h" // cmCreateTestSourceList -bool cmCreateTestSourceList::InitialPass(std::vector const& args) +bool cmCreateTestSourceList +::InitialPass(std::vector const& args, cmExecutionStatus &) { if (args.size() < 3) { diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h index 607b66f58..88df169cb 100644 --- a/Source/cmCreateTestSourceList.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx index f0bd7d875..685f50d62 100644 --- a/Source/cmDefinePropertyCommand.cxx +++ b/Source/cmDefinePropertyCommand.cxx @@ -18,8 +18,8 @@ #include "cmake.h" // cmDefinePropertiesCommand -bool cmDefinePropertyCommand::InitialPass( - std::vector const& args) +bool cmDefinePropertyCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 5 ) { diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h index 5da7b343a..4f95d4666 100644 --- a/Source/cmDefinePropertyCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmElseCommand.cxx b/Source/cmElseCommand.cxx index 939f7d899..4305b5ccf 100644 --- a/Source/cmElseCommand.cxx +++ b/Source/cmElseCommand.cxx @@ -16,7 +16,8 @@ =========================================================================*/ #include "cmElseCommand.h" -bool cmElseCommand::InitialPass(std::vector const&) +bool cmElseCommand::InitialPass(std::vector const&, + cmExecutionStatus &) { this->SetError("An ELSE command was found outside of a proper " "IF ENDIF structure. Or its arguments did not match " diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h index 41b5bf991..689e9b937 100644 --- a/Source/cmElseCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmElseIfCommand.cxx b/Source/cmElseIfCommand.cxx index 41b55b2c8..a296f0163 100644 --- a/Source/cmElseIfCommand.cxx +++ b/Source/cmElseIfCommand.cxx @@ -16,7 +16,8 @@ =========================================================================*/ #include "cmElseIfCommand.h" -bool cmElseIfCommand::InitialPass(std::vector const&) +bool cmElseIfCommand::InitialPass(std::vector const&, + cmExecutionStatus &) { this->SetError("An ELSEIF command was found outside of a proper " "IF ENDIF structure."); diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h index 2d251e430..78924991c 100644 --- a/Source/cmElseIfCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEnableLanguageCommand.cxx b/Source/cmEnableLanguageCommand.cxx index 2713b623b..b1e5622fe 100644 --- a/Source/cmEnableLanguageCommand.cxx +++ b/Source/cmEnableLanguageCommand.cxx @@ -18,7 +18,7 @@ // cmEnableLanguageCommand bool cmEnableLanguageCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { bool optional = false; std::vector languages; diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h index 242e47cdf..937a80440 100644 --- a/Source/cmEnableLanguageCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx index 3d94ba8e5..4a256e2f7 100644 --- a/Source/cmEnableTestingCommand.cxx +++ b/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 const&) +bool cmEnableTestingCommand::InitialPass(std::vector const&, + cmExecutionStatus &) { this->Makefile->AddDefinition("CMAKE_TESTING_ENABLED","1"); return true; diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h index 6f47f21b8..2ff804221 100644 --- a/Source/cmEnableTestingCommand.h +++ b/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 const&); + virtual bool InitialPass(std::vector const&, + cmExecutionStatus &); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmEndForEachCommand.cxx b/Source/cmEndForEachCommand.cxx index 717e44d25..13ce40b54 100644 --- a/Source/cmEndForEachCommand.cxx +++ b/Source/cmEndForEachCommand.cxx @@ -17,7 +17,8 @@ #include "cmEndForEachCommand.h" bool cmEndForEachCommand -::InvokeInitialPass(std::vector const&) +::InvokeInitialPass(std::vector const&, + cmExecutionStatus &) { this->SetError("An ENDFOREACH command was found outside of a proper " "FOREACH ENDFOREACH structure. Or its arguments did " diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h index 03e1ef2eb..92fcc503a 100644 --- a/Source/cmEndForEachCommand.h +++ b/Source/cmEndForEachCommand.h @@ -39,13 +39,15 @@ public: * Override cmCommand::InvokeInitialPass to get arguments before * expansion. */ - virtual bool InvokeInitialPass(std::vector const&); + virtual bool InvokeInitialPass(std::vector const&, + cmExecutionStatus &); /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&) {return false;} + virtual bool InitialPass(std::vector const&, + cmExecutionStatus &) {return false;} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndFunctionCommand.cxx b/Source/cmEndFunctionCommand.cxx index 353be465d..99ab1e2bc 100644 --- a/Source/cmEndFunctionCommand.cxx +++ b/Source/cmEndFunctionCommand.cxx @@ -17,7 +17,8 @@ #include "cmEndFunctionCommand.h" bool cmEndFunctionCommand -::InvokeInitialPass(std::vector const&) +::InvokeInitialPass(std::vector const&, + cmExecutionStatus &) { this->SetError("An ENDFUNCTION command was found outside of a proper " "FUNCTION ENDFUNCTION structure. Or its arguments did not " diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h index 2751c0fee..f1e64d45e 100644 --- a/Source/cmEndFunctionCommand.h +++ b/Source/cmEndFunctionCommand.h @@ -39,13 +39,15 @@ public: * Override cmCommand::InvokeInitialPass to get arguments before * expansion. */ - virtual bool InvokeInitialPass(std::vector const&); + virtual bool InvokeInitialPass(std::vector const&, + cmExecutionStatus &); /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&) {return false;} + virtual bool InitialPass(std::vector const&, + cmExecutionStatus &) {return false;} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndIfCommand.cxx b/Source/cmEndIfCommand.cxx index 8fe3a1b52..207d56775 100644 --- a/Source/cmEndIfCommand.cxx +++ b/Source/cmEndIfCommand.cxx @@ -16,7 +16,8 @@ =========================================================================*/ #include "cmEndIfCommand.h" #include // required for atof -bool cmEndIfCommand::InitialPass(std::vector const&) +bool cmEndIfCommand::InitialPass(std::vector const&, + cmExecutionStatus &) { const char* versionValue = this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION"); diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h index 846e991af..ffa6cbc9c 100644 --- a/Source/cmEndIfCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndMacroCommand.cxx b/Source/cmEndMacroCommand.cxx index a2ba86260..055ab3263 100644 --- a/Source/cmEndMacroCommand.cxx +++ b/Source/cmEndMacroCommand.cxx @@ -17,7 +17,8 @@ #include "cmEndMacroCommand.h" bool cmEndMacroCommand -::InvokeInitialPass(std::vector const&) +::InvokeInitialPass(std::vector const&, + cmExecutionStatus &) { this->SetError("An ENDMACRO command was found outside of a proper " "MACRO ENDMACRO structure. Or its arguments did not " diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h index d0b0982f9..0cd24add9 100644 --- a/Source/cmEndMacroCommand.h +++ b/Source/cmEndMacroCommand.h @@ -39,13 +39,15 @@ public: * Override cmCommand::InvokeInitialPass to get arguments before * expansion. */ - virtual bool InvokeInitialPass(std::vector const&); + virtual bool InvokeInitialPass(std::vector const&, + cmExecutionStatus &); /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&) {return false;} + virtual bool InitialPass(std::vector const&, + cmExecutionStatus &) {return false;} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndWhileCommand.cxx b/Source/cmEndWhileCommand.cxx index 4a49ddedb..da48e892e 100644 --- a/Source/cmEndWhileCommand.cxx +++ b/Source/cmEndWhileCommand.cxx @@ -17,7 +17,8 @@ #include "cmEndWhileCommand.h" bool cmEndWhileCommand -::InvokeInitialPass(std::vector const&) +::InvokeInitialPass(std::vector const&, + cmExecutionStatus &) { this->SetError("An ENDWHILE command was found outside of a proper " "WHILE ENDWHILE structure. Or its arguments did not " diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h index da0a91712..e635ecd98 100644 --- a/Source/cmEndWhileCommand.h +++ b/Source/cmEndWhileCommand.h @@ -39,13 +39,15 @@ public: * Override cmCommand::InvokeInitialPass to get arguments before * expansion. */ - virtual bool InvokeInitialPass(std::vector const&); + virtual bool InvokeInitialPass(std::vector const&, + cmExecutionStatus &status); /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&) {return false;} + virtual bool InitialPass(std::vector const&, + cmExecutionStatus &) {return false;} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index 3acf36a0e..4eb3937bd 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -18,7 +18,8 @@ #include "cmSystemTools.h" // cmExecProgramCommand -bool cmExecProgramCommand::InitialPass(std::vector const& args) +bool cmExecProgramCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h index a16c8f7d4..97210e5bc 100644 --- a/Source/cmExecProgramCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index c437ac91c..3b09e484c 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -33,7 +33,7 @@ void cmExecuteProcessCommandAppend(std::vector& output, // cmExecuteProcessCommand bool cmExecuteProcessCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h index 8564e2b09..2d550438a 100644 --- a/Source/cmExecuteProcessCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h new file mode 100644 index 000000000..66a567ebd --- /dev/null +++ b/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 diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index 523528d76..3dca7d8cf 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -39,7 +39,7 @@ cmExportCommand::cmExportCommand() // cmExportCommand bool cmExportCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index 199a128a4..c79f46d20 100644 --- a/Source/cmExportCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx index 6720c3e40..4a49696b9 100644 --- a/Source/cmExportLibraryDependencies.cxx +++ b/Source/cmExportLibraryDependencies.cxx @@ -23,7 +23,7 @@ #include bool cmExportLibraryDependenciesCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmExportLibraryDependencies.h b/Source/cmExportLibraryDependencies.h index ac091840e..6fa92d0b9 100644 --- a/Source/cmExportLibraryDependencies.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This is called at the end after all the information diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 43c4494b2..8090eb1e6 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -19,7 +19,8 @@ #include "cmSourceFile.h" // cmFLTKWrapUICommand -bool cmFLTKWrapUICommand::InitialPass(std::vector const& args) +bool cmFLTKWrapUICommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h index b383a91e6..48155347d 100644 --- a/Source/cmFLTKWrapUICommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This is called at the end after all the information diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index c03bf71ec..4ab73db20 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -54,7 +54,8 @@ static mode_t mode_setgid = S_ISGID; #endif // cmLibraryCommand -bool cmFileCommand::InitialPass(std::vector const& args) +bool cmFileCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 2fed8afa6..a69844a76 100644 --- a/Source/cmFileCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 45eb539c2..f1bce09b0 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -55,7 +55,8 @@ cmFindLibraryCommand::cmFindLibraryCommand() } // cmFindLibraryCommand -bool cmFindLibraryCommand::InitialPass(std::vector const& argsIn) +bool cmFindLibraryCommand +::InitialPass(std::vector const& argsIn, cmExecutionStatus &) { this->VariableDocumentation = "Path to a library."; this->CMakePathName = "LIBRARY"; diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index aa4e46cbf..233f766a0 100644 --- a/Source/cmFindLibraryCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 247282b15..31874328d 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -231,7 +231,8 @@ const char* cmFindPackageCommand::GetFullDocumentation() } //---------------------------------------------------------------------------- -bool cmFindPackageCommand::InitialPass(std::vector const& args) +bool cmFindPackageCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 7090eeeec..53d749c88 100644 --- a/Source/cmFindPackageCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 628018772..c04594ac6 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -70,7 +70,8 @@ const char* cmFindPathCommand::GetFullDocumentation() } // cmFindPathCommand -bool cmFindPathCommand::InitialPass(std::vector const& argsIn) +bool cmFindPathCommand +::InitialPass(std::vector const& argsIn, cmExecutionStatus &) { this->VariableDocumentation = "Path to a file."; this->CMakePathName = "INCLUDE"; diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index f4a4f01a2..1baceca32 100644 --- a/Source/cmFindPathCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 318dc134b..c2b7ca757 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -51,7 +51,8 @@ cmFindProgramCommand::cmFindProgramCommand() } // cmFindProgramCommand -bool cmFindProgramCommand::InitialPass(std::vector const& argsIn) +bool cmFindProgramCommand +::InitialPass(std::vector const& argsIn, cmExecutionStatus &) { this->VariableDocumentation = "Path to a program."; this->CMakePathName = "PROGRAM"; diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h index 79494f3f5..99b0dc926 100644 --- a/Source/cmFindProgramCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 1f9b84cf8..848c6a4fe 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 const& args) +bool cmForEachCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index 0e2109477..6ef217a51 100644 --- a/Source/cmForEachCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h index c9ba96d34..a169cc184 100644 --- a/Source/cmFunctionBlocker.h +++ b/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 diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 5828cdd85..1ff9d59e1 100644 --- a/Source/cmFunctionCommand.cxx +++ b/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& args); + virtual bool InvokeInitialPass(const std::vector& args, + cmExecutionStatus &); - virtual bool InitialPass(std::vector const&) { return false; }; + virtual bool InitialPass(std::vector 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& args) +(const std::vector& args, + cmExecutionStatus &) { // Expand the argument list to the function. std::vector 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 const& args) +bool cmFunctionCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index 36be51ffc..aff479224 100644 --- a/Source/cmFunctionCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 21ef549e4..09e706817 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -19,8 +19,8 @@ #include "cmake.h" // cmGetCMakePropertyCommand -bool cmGetCMakePropertyCommand::InitialPass( - std::vector const& args) +bool cmGetCMakePropertyCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h index b0c6b1385..c1f66d990 100644 --- a/Source/cmGetCMakePropertyCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index dd6affdfe..113886f17 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -19,8 +19,8 @@ #include "cmake.h" // cmGetDirectoryPropertyCommand -bool cmGetDirectoryPropertyCommand::InitialPass( - std::vector const& args) +bool cmGetDirectoryPropertyCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index 2e3085e9f..542cf4c71 100644 --- a/Source/cmGetDirectoryPropertyCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 7bd5ac962..d06efe88e 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -19,7 +19,7 @@ // cmGetFilenameComponentCommand bool cmGetFilenameComponentCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 3) { diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index b87ebff75..66e958f4b 100644 --- a/Source/cmGetFilenameComponentCommand.h +++ b/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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 2649cb68e..0a37b9749 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -27,7 +27,8 @@ cmGetPropertyCommand::cmGetPropertyCommand() } //---------------------------------------------------------------------------- -bool cmGetPropertyCommand::InitialPass(std::vector const& args) +bool cmGetPropertyCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 3 ) { diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h index f7c8ece53..0df2371e6 100644 --- a/Source/cmGetPropertyCommand.h +++ b/Source/cmGetPropertyCommand.h @@ -33,7 +33,8 @@ public: * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index 366ff165a..a291a0c2f 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -19,8 +19,8 @@ #include "cmSourceFile.h" // cmSetSourceFilePropertyCommand -bool cmGetSourceFilePropertyCommand::InitialPass( - std::vector const& args) +bool cmGetSourceFilePropertyCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() != 3 ) { diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h index 7393548a2..81fd49dd7 100644 --- a/Source/cmGetSourceFilePropertyCommand.h +++ b/Source/cmGetSourceFilePropertyCommand.h @@ -31,7 +31,8 @@ public: * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index e0e85bda8..963e16ad5 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -17,8 +17,8 @@ #include "cmGetTargetPropertyCommand.h" // cmSetTargetPropertyCommand -bool cmGetTargetPropertyCommand::InitialPass( - std::vector const& args) +bool cmGetTargetPropertyCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() != 3 ) { diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h index 64ab8d347..820fdec91 100644 --- a/Source/cmGetTargetPropertyCommand.h +++ b/Source/cmGetTargetPropertyCommand.h @@ -31,7 +31,8 @@ public: * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx index d4cae2444..3b6503d33 100644 --- a/Source/cmGetTestPropertyCommand.cxx +++ b/Source/cmGetTestPropertyCommand.cxx @@ -20,8 +20,8 @@ #include "cmTest.h" // cmGetTestPropertyCommand -bool cmGetTestPropertyCommand::InitialPass( - std::vector const& args) +bool cmGetTestPropertyCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 3 ) { diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h index 46588a446..c271a4582 100644 --- a/Source/cmGetTestPropertyCommand.h +++ b/Source/cmGetTestPropertyCommand.h @@ -31,7 +31,8 @@ public: * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index f5bd6cc13..bc82c4265 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -22,89 +22,122 @@ #include bool cmIfFunctionBlocker:: -IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) +IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, + cmExecutionStatus &inStatus) { - // if we are blocking then all we need to do is keep track of - // scope depth of nested if statements - if (this->IsBlocking) + // Prevent recusion and don't let this blocker block its own + // commands. + if (this->Executing) { - if (!cmSystemTools::Strucmp(lff.Name.c_str(),"if")) - { - this->ScopeDepth++; - return true; - } + return false; } - if (this->IsBlocking && this->ScopeDepth) + // we start by recording all the functions + if (!cmSystemTools::Strucmp(lff.Name.c_str(),"if")) { - if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endif")) - { - this->ScopeDepth--; - } - return true; + this->ScopeDepth++; } - - // watch for our ELSE or ENDIF - if (!cmSystemTools::Strucmp(lff.Name.c_str(),"else") || - !cmSystemTools::Strucmp(lff.Name.c_str(),"elseif") || - !cmSystemTools::Strucmp(lff.Name.c_str(),"endif")) + if (!cmSystemTools::Strucmp(lff.Name.c_str(),"endif")) { - // if it was an else statement then we should change state - // and block this Else Command - if (!cmSystemTools::Strucmp(lff.Name.c_str(),"else")) + this->ScopeDepth--; + // if this is the endif for this if statement, then start executing + if (!this->ScopeDepth) { - this->IsBlocking = this->HasRun; - return true; - } - // if it was an elseif statement then we should check state - // and possibly block this Else Command - if (!cmSystemTools::Strucmp(lff.Name.c_str(),"elseif")) - { - if (!this->HasRun) + // execute the functions for the true parts of the if statement + this->Executing = true; + cmExecutionStatus status; + int scopeDepth = 0; + for(unsigned int c = 0; c < this->Functions.size(); ++c) { - char* errorString = 0; - - std::vector expandedArguments; - mf.ExpandArguments(lff.Arguments, expandedArguments); - bool isTrue = - cmIfCommand::IsTrue(expandedArguments,&errorString,&mf); - - if (errorString) + // keep track of scope depth + if (!cmSystemTools::Strucmp(this->Functions[c].Name.c_str(),"if")) { - std::string err = "had incorrect arguments: "; - unsigned int i; - for(i =0; i < lff.Arguments.size(); ++i) - { - err += (lff.Arguments[i].Quoted?"\"":""); - err += lff.Arguments[i].Value; - err += (lff.Arguments[i].Quoted?"\"":""); - err += " "; - } - err += "("; - err += errorString; - err += ")."; - cmSystemTools::Error(err.c_str()); - delete [] errorString; - return false; + scopeDepth++; } - - if (isTrue) + if (!cmSystemTools::Strucmp(this->Functions[c].Name.c_str(),"endif")) { - this->IsBlocking = false; + scopeDepth--; + } + // watch for our state change + if (scopeDepth == 0 && + !cmSystemTools::Strucmp(this->Functions[c].Name.c_str(),"else")) + { + this->IsBlocking = this->HasRun; this->HasRun = true; - return true; + } + else if (scopeDepth == 0 && !cmSystemTools::Strucmp + (this->Functions[c].Name.c_str(),"elseif")) + { + if (this->HasRun) + { + this->IsBlocking = true; + } + else + { + char* errorString = 0; + + std::vector expandedArguments; + mf.ExpandArguments(this->Functions[c].Arguments, + expandedArguments); + bool isTrue = + cmIfCommand::IsTrue(expandedArguments,&errorString,&mf); + + if (errorString) + { + std::string err = "had incorrect arguments: "; + unsigned int i; + for(i =0; i < this->Functions[c].Arguments.size(); ++i) + { + err += (this->Functions[c].Arguments[i].Quoted?"\"":""); + err += this->Functions[c].Arguments[i].Value; + err += (this->Functions[c].Arguments[i].Quoted?"\"":""); + err += " "; + } + err += "("; + err += errorString; + err += ")."; + cmSystemTools::Error(err.c_str()); + delete [] errorString; + return false; + } + + if (isTrue) + { + this->IsBlocking = false; + this->HasRun = true; + } + } + } + + // should we execute? + else if (!this->IsBlocking) + { + status.Clear(); + mf.ExecuteCommand(this->Functions[c],status); + if (status.GetReturnInvoked()) + { + inStatus.SetReturnInvoked(true); + mf.RemoveFunctionBlocker(lff); + return true; + } + if (status.GetBreakInvoked()) + { + inStatus.SetBreakInvoked(true); + mf.RemoveFunctionBlocker(lff); + return true; + } } } - this->IsBlocking = true; + mf.RemoveFunctionBlocker(lff); return true; } - // otherwise it must be an ENDIF statement, in that case remove the - // function blocker - mf.RemoveFunctionBlocker(lff); - return true; } - return this->IsBlocking; + // record the command + this->Functions.push_back(lff); + + // always return true + return true; } bool cmIfFunctionBlocker::ShouldRemove(const cmListFileFunction& lff, @@ -142,7 +175,8 @@ ScopeEnded(cmMakefile &mf) } bool cmIfCommand -::InvokeInitialPass(const std::vector& args) +::InvokeInitialPass(const std::vector& args, + cmExecutionStatus &) { char* errorString = 0; @@ -172,6 +206,7 @@ bool cmIfCommand cmIfFunctionBlocker *f = new cmIfFunctionBlocker(); // if is isn't true block the commands + f->ScopeDepth = 1; f->IsBlocking = !isTrue; if (isTrue) { diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 9ba4434d9..ca729e79b 100644 --- a/Source/cmIfCommand.h +++ b/Source/cmIfCommand.h @@ -28,18 +28,22 @@ class cmIfFunctionBlocker : public cmFunctionBlocker { public: - cmIfFunctionBlocker() {this->HasRun = false; this->ScopeDepth = 0;} + cmIfFunctionBlocker() { + this->HasRun = false; this->ScopeDepth = 0; this->Executing = false;} virtual ~cmIfFunctionBlocker() {} virtual bool IsFunctionBlocked(const cmListFileFunction& lff, - cmMakefile &mf); + cmMakefile &mf, + cmExecutionStatus &); virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf); virtual void ScopeEnded(cmMakefile &mf); std::vector Args; + std::vector Functions; bool IsBlocking; bool HasRun; unsigned int ScopeDepth; + bool Executing; }; /** \class cmIfCommand @@ -62,13 +66,15 @@ public: * This overrides the default InvokeInitialPass implementation. * It records the arguments before expansion. */ - virtual bool InvokeInitialPass(const std::vector& args); + virtual bool InvokeInitialPass(const std::vector& args, + cmExecutionStatus &); /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&) { return false; } + virtual bool InitialPass(std::vector const&, + cmExecutionStatus &) { return false;}; /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 8b63fe970..2e85b2404 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -18,7 +18,8 @@ // cmIncludeCommand -bool cmIncludeCommand::InitialPass(std::vector const& args) +bool cmIncludeCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if (args.size()< 1 || args.size() > 4) { diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h index b6a21d993..aaeea395a 100644 --- a/Source/cmIncludeCommand.h +++ b/Source/cmIncludeCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index 73f2e1253..2d3271ee2 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -18,7 +18,7 @@ // cmIncludeDirectoryCommand bool cmIncludeDirectoryCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index 7eaf8703c..d51af5cb8 100644 --- a/Source/cmIncludeDirectoryCommand.h +++ b/Source/cmIncludeDirectoryCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index d4c4c80e4..d1f2a78ae 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -18,7 +18,7 @@ // cmIncludeExternalMSProjectCommand bool cmIncludeExternalMSProjectCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2) { diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h index 780ab04bf..c8b7e36f1 100644 --- a/Source/cmIncludeExternalMSProjectCommand.h +++ b/Source/cmIncludeExternalMSProjectCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmIncludeRegularExpressionCommand.cxx b/Source/cmIncludeRegularExpressionCommand.cxx index f94b97117..8b0ff7a68 100644 --- a/Source/cmIncludeRegularExpressionCommand.cxx +++ b/Source/cmIncludeRegularExpressionCommand.cxx @@ -18,7 +18,7 @@ // cmIncludeRegularExpressionCommand bool cmIncludeRegularExpressionCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if((args.size() < 1) || (args.size() > 2)) { diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h index 699574be8..b0bd2f602 100644 --- a/Source/cmIncludeRegularExpressionCommand.h +++ b/Source/cmIncludeRegularExpressionCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index c04a682b7..915cd4b3f 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -46,7 +46,8 @@ static cmInstallFilesGenerator* CreateInstallFilesGenerator( // cmInstallCommand -bool cmInstallCommand::InitialPass(std::vector const& args) +bool cmInstallCommand::InitialPass(std::vector const& args, + cmExecutionStatus &) { // Allow calling with no arguments so that arguments may be built up // using a variable that may be left empty. diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 15332ae8b..f0f69e049 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 48d3e7036..4b09aceed 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -20,7 +20,7 @@ // cmExecutableCommand bool cmInstallFilesCommand -::InitialPass(std::vector const& argsIn) +::InitialPass(std::vector const& argsIn, cmExecutionStatus &) { if(argsIn.size() < 2) { diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h index 7885d180e..6262833dc 100644 --- a/Source/cmInstallFilesCommand.h +++ b/Source/cmInstallFilesCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index a26b6ae61..8a29665ee 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -18,7 +18,7 @@ // cmExecutableCommand bool cmInstallProgramsCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2) { diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h index 81800efa4..04fbb07f1 100644 --- a/Source/cmInstallProgramsCommand.h +++ b/Source/cmInstallProgramsCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx index 246b118af..d3ecddf7e 100644 --- a/Source/cmInstallTargetsCommand.cxx +++ b/Source/cmInstallTargetsCommand.cxx @@ -18,7 +18,7 @@ // cmExecutableCommand bool cmInstallTargetsCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h index e98b831b9..c6c8657f9 100644 --- a/Source/cmInstallTargetsCommand.h +++ b/Source/cmInstallTargetsCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index 5eeb5bb30..81b89452b 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -18,7 +18,7 @@ // cmLinkDirectoriesCommand bool cmLinkDirectoriesCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index fe08656e8..7f37ebfb7 100644 --- a/Source/cmLinkDirectoriesCommand.h +++ b/Source/cmLinkDirectoriesCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index 94f00512e..b9e7a8fc1 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -17,7 +17,8 @@ #include "cmLinkLibrariesCommand.h" // cmLinkLibrariesCommand -bool cmLinkLibrariesCommand::InitialPass(std::vector const& args) +bool cmLinkLibrariesCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h index a7e99629b..0953bdbe1 100644 --- a/Source/cmLinkLibrariesCommand.h +++ b/Source/cmLinkLibrariesCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index b7519ab61..f990ad592 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -21,7 +21,8 @@ #include // required for atoi #include //---------------------------------------------------------------------------- -bool cmListCommand::InitialPass(std::vector const& args) +bool cmListCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index b5193b595..d607b4253 100644 --- a/Source/cmListCommand.h +++ b/Source/cmListCommand.h @@ -38,7 +38,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index 062a7a66c..0a8d3e6bc 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -19,7 +19,8 @@ #include // cmLoadCacheCommand -bool cmLoadCacheCommand::InitialPass(std::vector const& args) +bool cmLoadCacheCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if (args.size()< 1) { diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index e19c35b3d..4574a904d 100644 --- a/Source/cmLoadCacheCommand.h +++ b/Source/cmLoadCacheCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index fe73ee853..fe6744342 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -58,7 +58,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &); /** * This is called at the end after all the information @@ -153,7 +154,8 @@ extern "C" void TrapsForSignalsCFunction(int sig) const char* cmLoadedCommand::LastName = 0; -bool cmLoadedCommand::InitialPass(std::vector const& args) +bool cmLoadedCommand::InitialPass(std::vector const& args, + cmExecutionStatus &) { if (!info.InitialPass) { @@ -222,7 +224,8 @@ cmLoadedCommand::~cmLoadedCommand() } // cmLoadCommandCommand -bool cmLoadCommandCommand::InitialPass(std::vector const& args) +bool cmLoadCommandCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index e63b9f1ab..c654c6d7f 100644 --- a/Source/cmLoadCommandCommand.h +++ b/Source/cmLoadCommandCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index f5c418771..6b927631d 100644 --- a/Source/cmMacroCommand.cxx +++ b/Source/cmMacroCommand.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& args); + virtual bool InvokeInitialPass(const std::vector& args, + cmExecutionStatus &); - virtual bool InitialPass(std::vector const&) { return false; }; + virtual bool InitialPass(std::vector const&, + cmExecutionStatus &) { return false; }; /** * The name of the command as specified in CMakeList.txt. @@ -83,7 +85,8 @@ public: bool cmMacroHelperCommand::InvokeInitialPass -(const std::vector& args) +(const std::vector& args, + cmExecutionStatus &inStatus) { // Expand the argument list to the macro. std::vector expandedArgs; @@ -233,7 +236,8 @@ bool cmMacroHelperCommand::InvokeInitialPass } newLFF.Arguments.push_back(arg); } - if(!this->Makefile->ExecuteCommand(newLFF)) + cmExecutionStatus status; + if(!this->Makefile->ExecuteCommand(newLFF,status)) { if(args.size()) { @@ -253,12 +257,23 @@ bool cmMacroHelperCommand::InvokeInitialPass cmSystemTools::Error(error.str().c_str()); return false; } + if (status.GetReturnInvoked()) + { + inStatus.SetReturnInvoked(true); + return true; + } + if (status.GetBreakInvoked()) + { + inStatus.SetBreakInvoked(true); + return true; + } } return true; } bool cmMacroFunctionBlocker:: -IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) +IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, + cmExecutionStatus &) { // record commands until we hit the ENDMACRO // at the ENDMACRO call we shift gears and start looking for invocations @@ -337,7 +352,8 @@ ScopeEnded(cmMakefile &mf) this->Args[0].c_str()); } -bool cmMacroCommand::InitialPass(std::vector const& args) +bool cmMacroCommand::InitialPass(std::vector const& args, + cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index 01396c319..4fcd597a7 100644 --- a/Source/cmMacroCommand.h +++ b/Source/cmMacroCommand.h @@ -30,7 +30,9 @@ class cmMacroFunctionBlocker : public cmFunctionBlocker public: cmMacroFunctionBlocker() {this->Depth=0;} virtual ~cmMacroFunctionBlocker() {} - 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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmMakeDirectoryCommand.cxx b/Source/cmMakeDirectoryCommand.cxx index 3696296a8..6b1459eaa 100644 --- a/Source/cmMakeDirectoryCommand.cxx +++ b/Source/cmMakeDirectoryCommand.cxx @@ -17,7 +17,8 @@ #include "cmMakeDirectoryCommand.h" // cmMakeDirectoryCommand -bool cmMakeDirectoryCommand::InitialPass(std::vector const& args) +bool cmMakeDirectoryCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() != 1 ) { diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h index db6b11311..77f230f28 100644 --- a/Source/cmMakeDirectoryCommand.h +++ b/Source/cmMakeDirectoryCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6e99c1709..151ad5e77 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -278,17 +278,20 @@ bool cmMakefile::CommandExists(const char* name) const return this->GetCMakeInstance()->CommandExists(name); } -bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff) +bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff, + cmExecutionStatus &status) { bool result = true; + // quick return if blocked - if(this->IsFunctionBlocked(lff)) + if(this->IsFunctionBlocked(lff,status)) { // No error. return result; } - + std::string name = lff.Name; + // execute the command cmCommand *rm = this->GetCMakeInstance()->GetCommand(name.c_str()); @@ -319,7 +322,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff) (!this->GetCMakeInstance()->GetScriptMode() || usedCommand->IsScriptable())) { - if(!usedCommand->InvokeInitialPass(lff.Arguments)) + if(!usedCommand->InvokeInitialPass(lff.Arguments,status)) { cmOStringStream error; error << "Error in cmake code at\n" @@ -478,8 +481,10 @@ bool cmMakefile::ReadListFile(const char* filename_in, const size_t numberFunctions = cacheFile.Functions.size(); for(size_t i =0; i < numberFunctions; ++i) { - this->ExecuteCommand(cacheFile.Functions[i]); - if ( cmSystemTools::GetFatalErrorOccured() ) + cmExecutionStatus status; + this->ExecuteCommand(cacheFile.Functions[i],status); + if (status.GetReturnInvoked() || + cmSystemTools::GetFatalErrorOccured() ) { // pop the listfile off the stack this->ListFileStack.pop_back(); @@ -2110,7 +2115,8 @@ cmMakefile::FindSourceGroup(const char* source, } #endif -bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff) +bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff, + cmExecutionStatus &status) { // if there are no blockers get out of here if (this->FunctionBlockers.begin() == this->FunctionBlockers.end()) @@ -2124,7 +2130,7 @@ bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff) for (pos = this->FunctionBlockers.rbegin(); pos != this->FunctionBlockers.rend(); ++pos) { - if((*pos)->IsFunctionBlocked(lff, *this)) + if((*pos)->IsFunctionBlocked(lff, *this, status)) { return true; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 201a507b5..6bc80670d 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -17,12 +17,13 @@ #ifndef cmMakefile_h #define cmMakefile_h +#include "cmCacheManager.h" #include "cmData.h" +#include "cmExecutionStatus.h" +#include "cmListFileCache.h" +#include "cmPropertyMap.h" #include "cmSystemTools.h" #include "cmTarget.h" -#include "cmListFileCache.h" -#include "cmCacheManager.h" -#include "cmPropertyMap.h" #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmSourceGroup.h" @@ -630,8 +631,9 @@ public: * Execute a single CMake command. Returns true if the command * succeeded or false if it failed. */ - bool ExecuteCommand(const cmListFileFunction& lff); - + bool ExecuteCommand(const cmListFileFunction& lff, + cmExecutionStatus &status); + /** Check if a command exists. */ bool CommandExists(const char* name) const; @@ -796,7 +798,8 @@ protected: std::vector DefinitionStack; std::vector UsedCommands; cmLocalGenerator* LocalGenerator; - bool IsFunctionBlocked(const cmListFileFunction& lff); + bool IsFunctionBlocked(const cmListFileFunction& lff, + cmExecutionStatus &status); private: void Initialize(); diff --git a/Source/cmMarkAsAdvancedCommand.cxx b/Source/cmMarkAsAdvancedCommand.cxx index 93a843707..841b34c1b 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -18,7 +18,7 @@ // cmMarkAsAdvancedCommand bool cmMarkAsAdvancedCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index 73882850e..62923c71a 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index 6c8f7a248..c7dde3a74 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -19,7 +19,8 @@ #include "cmExprParserHelper.h" //---------------------------------------------------------------------------- -bool cmMathCommand::InitialPass(std::vector const& args) +bool cmMathCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if ( args.size() < 1 ) { diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index 9f0d23ce8..08504d8f1 100644 --- a/Source/cmMathCommand.h +++ b/Source/cmMathCommand.h @@ -38,7 +38,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index f77cfd58c..26d9012b8 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -17,7 +17,8 @@ #include "cmMessageCommand.h" // cmLibraryCommand -bool cmMessageCommand::InitialPass(std::vector const& args) +bool cmMessageCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index 02c5c23e9..54cccd436 100644 --- a/Source/cmMessageCommand.h +++ b/Source/cmMessageCommand.h @@ -38,7 +38,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 46bf045a0..0c704118a 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -17,7 +17,8 @@ #include "cmOptionCommand.h" // cmOptionCommand -bool cmOptionCommand::InitialPass(std::vector const& args) +bool cmOptionCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { bool argError = false; if(args.size() < 2) diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h index c93c39eb4..b9fa01ef9 100644 --- a/Source/cmOptionCommand.h +++ b/Source/cmOptionCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index e15fea2df..98dfabce6 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -177,7 +177,7 @@ void cmLBDepend::DependWalk(cmDependInformation* info) // cmOutputRequiredFilesCommand bool cmOutputRequiredFilesCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() != 2 ) { @@ -189,6 +189,21 @@ bool cmOutputRequiredFilesCommand this->File = args[0]; this->OutputFile = args[1]; + // compute the list of files + cmLBDepend md; + md.SetMakefile(this->Makefile); + md.AddSearchPath(this->Makefile->GetStartDirectory()); + // find the depends for a file + const cmDependInformation *info = md.FindDependencies(this->File.c_str()); + if (info) + { + // write them out + FILE *fout = fopen(this->OutputFile.c_str(),"w"); + std::set visited; + this->ListDependencies(info,fout, &visited); + fclose(fout); + } + return true; } @@ -221,20 +236,3 @@ ListDependencies(cmDependInformation const *info, } } -void cmOutputRequiredFilesCommand::FinalPass() -{ - // compute the list of files - cmLBDepend md; - md.SetMakefile(this->Makefile); - md.AddSearchPath(this->Makefile->GetStartDirectory()); - // find the depends for a file - const cmDependInformation *info = md.FindDependencies(this->File.c_str()); - if (info) - { - // write them out - FILE *fout = fopen(this->OutputFile.c_str(),"w"); - std::set visited; - this->ListDependencies(info,fout, &visited); - fclose(fout); - } -} diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h index da1844649..4241b2ecc 100644 --- a/Source/cmOutputRequiredFilesCommand.h +++ b/Source/cmOutputRequiredFilesCommand.h @@ -39,9 +39,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args); - - virtual void FinalPass(); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmProjectCommand.cxx b/Source/cmProjectCommand.cxx index 31d878a78..1823b5f1e 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -17,7 +17,8 @@ #include "cmProjectCommand.h" // cmProjectCommand -bool cmProjectCommand::InitialPass(std::vector const& args) +bool cmProjectCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index 11e297ed8..4e9b2892e 100644 --- a/Source/cmProjectCommand.h +++ b/Source/cmProjectCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index 6348d92d4..991f29ac5 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -17,7 +17,8 @@ #include "cmQTWrapCPPCommand.h" // cmQTWrapCPPCommand -bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn) +bool cmQTWrapCPPCommand::InitialPass(std::vector const& argsIn, + cmExecutionStatus &) { if(argsIn.size() < 3 ) { diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index 98aeec0ff..814aab924 100644 --- a/Source/cmQTWrapCPPCommand.h +++ b/Source/cmQTWrapCPPCommand.h @@ -44,7 +44,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index ff86ed937..b8da0ff3c 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -17,7 +17,8 @@ #include "cmQTWrapUICommand.h" // cmQTWrapUICommand -bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn) +bool cmQTWrapUICommand::InitialPass(std::vector const& argsIn, + cmExecutionStatus &) { if(argsIn.size() < 4 ) { diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h index 491f17541..7f0101d98 100644 --- a/Source/cmQTWrapUICommand.h +++ b/Source/cmQTWrapUICommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx index 94388c033..b44d299c3 100644 --- a/Source/cmRemoveCommand.cxx +++ b/Source/cmRemoveCommand.cxx @@ -17,7 +17,8 @@ #include "cmRemoveCommand.h" // cmRemoveCommand -bool cmRemoveCommand::InitialPass(std::vector const& args) +bool cmRemoveCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h index 10766a9bb..6490e7c18 100644 --- a/Source/cmRemoveCommand.h +++ b/Source/cmRemoveCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmRemoveDefinitionsCommand.cxx b/Source/cmRemoveDefinitionsCommand.cxx index 764117107..f39dac033 100644 --- a/Source/cmRemoveDefinitionsCommand.cxx +++ b/Source/cmRemoveDefinitionsCommand.cxx @@ -18,7 +18,7 @@ // cmRemoveDefinitionsCommand bool cmRemoveDefinitionsCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { // it is OK to have no arguments if(args.size() < 1 ) diff --git a/Source/cmRemoveDefinitionsCommand.h b/Source/cmRemoveDefinitionsCommand.h index 8ee5086dc..52d50fb39 100644 --- a/Source/cmRemoveDefinitionsCommand.h +++ b/Source/cmRemoveDefinitionsCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmReturnCommand.cxx b/Source/cmReturnCommand.cxx new file mode 100644 index 000000000..b134d8225 --- /dev/null +++ b/Source/cmReturnCommand.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 "cmReturnCommand.h" + +// cmReturnCommand +bool cmReturnCommand::InitialPass(std::vector const&, + cmExecutionStatus &status) +{ + status.SetReturnInvoked(true); + return true; +} + diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h new file mode 100644 index 000000000..f10a5fdcb --- /dev/null +++ b/Source/cmReturnCommand.h @@ -0,0 +1,82 @@ +/*========================================================================= + + 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 cmReturnCommand_h +#define cmReturnCommand_h + +#include "cmCommand.h" + +/** \class cmReturnCommand + * \brief Return from a directory or function + * + * cmReturnCommand returns from a directory or function + */ +class cmReturnCommand : public cmCommand +{ +public: + /** + * This is a virtual constructor for the command. + */ + virtual cmCommand* Clone() + { + return new cmReturnCommand; + } + + /** + * This is called when the command is first encountered in + * the CMakeLists.txt file. + */ + virtual bool InitialPass(std::vector 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 "return";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Return from a directory or function."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + " return()\n" + "Returns from a directory or function. When this command is " + "encountered, it caused process of the current function or " + "directory to stop and control is return to the caller of the " + "function, or the parent directory if any. Note that a macro " + "is not a function and does not handle return liek a function does."; + } + + cmTypeMacro(cmReturnCommand, cmCommand); +}; + + + +#endif diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx index 5f3d88d98..6e015b7d2 100644 --- a/Source/cmSeparateArgumentsCommand.cxx +++ b/Source/cmSeparateArgumentsCommand.cxx @@ -18,7 +18,7 @@ // cmSeparateArgumentsCommand bool cmSeparateArgumentsCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() != 1 ) { diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h index 0bc87eff9..827f7f283 100644 --- a/Source/cmSeparateArgumentsCommand.h +++ b/Source/cmSeparateArgumentsCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 082dd4186..512ae9533 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -17,7 +17,8 @@ #include "cmSetCommand.h" // cmSetCommand -bool cmSetCommand::InitialPass(std::vector const& args) +bool cmSetCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 6f6ecd2bc..e818d6a44 100644 --- a/Source/cmSetCommand.h +++ b/Source/cmSetCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmSetDirectoryPropertiesCommand.cxx b/Source/cmSetDirectoryPropertiesCommand.cxx index 21333091a..2f34421b7 100644 --- a/Source/cmSetDirectoryPropertiesCommand.cxx +++ b/Source/cmSetDirectoryPropertiesCommand.cxx @@ -19,8 +19,8 @@ #include "cmake.h" // cmSetDirectoryPropertiesCommand -bool cmSetDirectoryPropertiesCommand::InitialPass( - std::vector const& args) +bool cmSetDirectoryPropertiesCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h index 039f21ae9..aed9f673d 100644 --- a/Source/cmSetDirectoryPropertiesCommand.h +++ b/Source/cmSetDirectoryPropertiesCommand.h @@ -31,7 +31,8 @@ public: * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 933a3e8cf..0922c1dd2 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -26,7 +26,8 @@ cmSetPropertyCommand::cmSetPropertyCommand() } //---------------------------------------------------------------------------- -bool cmSetPropertyCommand::InitialPass(std::vector const& args) +bool cmSetPropertyCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 06d4da59b..a6d3966ca 100644 --- a/Source/cmSetPropertyCommand.h +++ b/Source/cmSetPropertyCommand.h @@ -33,7 +33,8 @@ public: * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx index 5e7618d43..9c6153b16 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.cxx +++ b/Source/cmSetSourceFilesPropertiesCommand.cxx @@ -19,8 +19,8 @@ #include "cmSourceFile.h" // cmSetSourceFilesPropertiesCommand -bool cmSetSourceFilesPropertiesCommand::InitialPass( - std::vector const& args) +bool cmSetSourceFilesPropertiesCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h index fad76eefb..e210de262 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.h +++ b/Source/cmSetSourceFilesPropertiesCommand.h @@ -31,7 +31,8 @@ public: * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index 4fb2fb94d..ccbe0d5fa 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -19,8 +19,8 @@ #include "cmGlobalGenerator.h" // cmSetTargetPropertiesCommand -bool cmSetTargetPropertiesCommand::InitialPass( - std::vector const& args) +bool cmSetTargetPropertiesCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index bc48a7049..e9ff1ce95 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -31,7 +31,8 @@ public: * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index 0d4c3fc79..8a849b305 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -20,8 +20,8 @@ #include "cmTest.h" // cmSetTestsPropertiesCommand -bool cmSetTestsPropertiesCommand::InitialPass( - std::vector const& args) +bool cmSetTestsPropertiesCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index 8717d903a..e25b0a5f0 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -31,7 +31,8 @@ public: * This is called when the command is first encountered in * the input file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index 7e2e87e82..ef29638c8 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -19,7 +19,8 @@ #include // cmSiteNameCommand -bool cmSiteNameCommand::InitialPass(std::vector const& args) +bool cmSiteNameCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() != 1 ) { diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h index 7c0326847..6d46eecd8 100644 --- a/Source/cmSiteNameCommand.h +++ b/Source/cmSiteNameCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 97385c9ac..b21cada4d 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -48,7 +48,8 @@ inline std::vector tokenize(const std::string& str, } // cmSourceGroupCommand -bool cmSourceGroupCommand::InitialPass(std::vector const& args) +bool cmSourceGroupCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h index 5d56bf7b7..c4edf87d3 100644 --- a/Source/cmSourceGroupCommand.h +++ b/Source/cmSourceGroupCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 7ef39af94..df32afc07 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -23,7 +23,8 @@ #include //---------------------------------------------------------------------------- -bool cmStringCommand::InitialPass(std::vector const& args) +bool cmStringCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index f0b7c9e43..3fa8a8382 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -44,7 +44,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index 48b558dec..f932ebcf7 100644 --- a/Source/cmSubdirCommand.cxx +++ b/Source/cmSubdirCommand.cxx @@ -17,7 +17,8 @@ #include "cmSubdirCommand.h" // cmSubdirCommand -bool cmSubdirCommand::InitialPass(std::vector const& args) +bool cmSubdirCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h index bf21ab576..1e79bd8ae 100644 --- a/Source/cmSubdirCommand.h +++ b/Source/cmSubdirCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmSubdirDependsCommand.cxx b/Source/cmSubdirDependsCommand.cxx index bcb3d9b6f..c3250e42b 100644 --- a/Source/cmSubdirDependsCommand.cxx +++ b/Source/cmSubdirDependsCommand.cxx @@ -17,7 +17,8 @@ #include "cmSubdirDependsCommand.h" // cmSubdirDependsCommand -bool cmSubdirDependsCommand::InitialPass(std::vector const& ) +bool cmSubdirDependsCommand::InitialPass(std::vector const& , + cmExecutionStatus &) { return true; } diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h index 4a1ca225f..0e7bbc610 100644 --- a/Source/cmSubdirDependsCommand.h +++ b/Source/cmSubdirDependsCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 2b649b1e2..8c06e071e 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -17,8 +17,8 @@ #include "cmTargetLinkLibrariesCommand.h" // cmTargetLinkLibrariesCommand -bool cmTargetLinkLibrariesCommand::InitialPass(std::vector - const& args) +bool cmTargetLinkLibrariesCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { // must have one argument if(args.size() < 1) diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index d84faa62a..1e2cac181 100644 --- a/Source/cmTargetLinkLibrariesCommand.h +++ b/Source/cmTargetLinkLibrariesCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx index a48f7232a..b286e766a 100644 --- a/Source/cmTryCompileCommand.cxx +++ b/Source/cmTryCompileCommand.cxx @@ -17,7 +17,8 @@ #include "cmTryCompileCommand.h" // cmTryCompileCommand -bool cmTryCompileCommand::InitialPass(std::vector const& argv) +bool cmTryCompileCommand +::InitialPass(std::vector const& argv, cmExecutionStatus &) { if(argv.size() < 3) { diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h index 27a65abb5..2a45b495f 100644 --- a/Source/cmTryCompileCommand.h +++ b/Source/cmTryCompileCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index e6b872dd0..e7dff781f 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -19,14 +19,15 @@ #include "cmTryCompileCommand.h" // cmTryRunCommand -bool cmTryRunCommand::InitialPass(std::vector const& argv) +bool cmTryRunCommand +::InitialPass(std::vector const& argv, cmExecutionStatus &) { if(argv.size() < 4) { return false; } - // build an arg list for TryCompile and extract the runArgs + // build an arg list for TryCompile and extract the runArgs, std::vector tryCompile; this->CompileResultVariable = ""; diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h index 0a8648697..a839fe4e6 100644 --- a/Source/cmTryRunCommand.h +++ b/Source/cmTryRunCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 0e73cefc8..63ca142ea 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -21,7 +21,7 @@ // cmUseMangledMesaCommand bool cmUseMangledMesaCommand -::InitialPass(std::vector const& args) +::InitialPass(std::vector const& args, cmExecutionStatus &) { // expected two arguments: // arguement one: the full path to gl_mangle.h diff --git a/Source/cmUseMangledMesaCommand.h b/Source/cmUseMangledMesaCommand.h index 8c38ab66d..971d92678 100644 --- a/Source/cmUseMangledMesaCommand.h +++ b/Source/cmUseMangledMesaCommand.h @@ -44,7 +44,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 8485bfd1d..f8683cee3 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -17,7 +17,8 @@ #include "cmUtilitySourceCommand.h" // cmUtilitySourceCommand -bool cmUtilitySourceCommand::InitialPass(std::vector const& args) +bool cmUtilitySourceCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 3) { diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h index 4fd0474ed..921c45584 100644 --- a/Source/cmUtilitySourceCommand.h +++ b/Source/cmUtilitySourceCommand.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 const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index b119c94bd..69b50dbb6 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -18,8 +18,8 @@ #include "cmCacheManager.h" // cmLibraryCommand -bool cmVariableRequiresCommand::InitialPass(std::vectorconst& - args) +bool cmVariableRequiresCommand +::InitialPass(std::vectorconst& args, cmExecutionStatus &) { if(args.size() < 3 ) { diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h index 75e6367a1..f953bdc55 100644 --- a/Source/cmVariableRequiresCommand.h +++ b/Source/cmVariableRequiresCommand.h @@ -38,7 +38,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 8c5ed3106..a5ee70c91 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -35,7 +35,8 @@ cmVariableWatchCommand::cmVariableWatchCommand() } //---------------------------------------------------------------------------- -bool cmVariableWatchCommand::InitialPass(std::vector const& args) +bool cmVariableWatchCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if ( args.size() < 1 ) { @@ -102,7 +103,8 @@ void cmVariableWatchCommand::VariableAccessed(const std::string& variable, newLFF.Name = command; newLFF.FilePath = "Some weird path"; newLFF.Line = 9999; - if(!makefile->ExecuteCommand(newLFF)) + cmExecutionStatus status; + if(!makefile->ExecuteCommand(newLFF,status)) { arg.FilePath = "Unknown"; arg.Line = 0; diff --git a/Source/cmVariableWatchCommand.h b/Source/cmVariableWatchCommand.h index db7a4d07e..61d6226e8 100644 --- a/Source/cmVariableWatchCommand.h +++ b/Source/cmVariableWatchCommand.h @@ -48,7 +48,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index e4e17d993..96842218b 100644 --- a/Source/cmWhileCommand.cxx +++ b/Source/cmWhileCommand.cxx @@ -18,7 +18,8 @@ #include "cmIfCommand.h" bool cmWhileFunctionBlocker:: -IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) +IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, + cmExecutionStatus &inStatus) { // Prevent recusion and don't let this blocker block its own // commands. @@ -51,7 +52,19 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) // Invoke all the functions that were collected in the block. for(unsigned int c = 0; c < this->Functions.size(); ++c) { - mf.ExecuteCommand(this->Functions[c]); + cmExecutionStatus status; + mf.ExecuteCommand(this->Functions[c],status); + if (status.GetReturnInvoked()) + { + inStatus.SetReturnInvoked(true); + mf.RemoveFunctionBlocker(lff); + return true; + } + if (status.GetBreakInvoked()) + { + mf.RemoveFunctionBlocker(lff); + return true; + } } expandedArguments.clear(); mf.ExpandArguments(this->Args, expandedArguments); @@ -99,8 +112,9 @@ ScopeEnded(cmMakefile &mf) mf.GetCurrentDirectory()); } -bool cmWhileCommand::InvokeInitialPass( - const std::vector& args) +bool cmWhileCommand +::InvokeInitialPass(const std::vector& args, + cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index a934db4c1..c95df73fb 100644 --- a/Source/cmWhileCommand.h +++ b/Source/cmWhileCommand.h @@ -32,7 +32,8 @@ public: cmWhileFunctionBlocker() {Executing = false; Depth=0;} virtual ~cmWhileFunctionBlocker() {} 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,13 +64,15 @@ public: * This overrides the default InvokeInitialPass implementation. * It records the arguments before expansion. */ - virtual bool InvokeInitialPass(const std::vector& args); + virtual bool InvokeInitialPass(const std::vector& args, + cmExecutionStatus &); /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const&) { return false; } + virtual bool InitialPass(std::vector const&, + cmExecutionStatus &) { return false; } /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index 08d02b8e6..8afd7586a 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -20,7 +20,8 @@ #include // cmLibraryCommand -bool cmWriteFileCommand::InitialPass(std::vector const& args) +bool cmWriteFileCommand +::InitialPass(std::vector const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h index 643f9496d..0c69dd810 100644 --- a/Source/cmWriteFileCommand.h +++ b/Source/cmWriteFileCommand.h @@ -38,7 +38,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector const& args); + virtual bool InitialPass(std::vector const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode.