From 0e69d38004787f1d55eb7188cde4cf45e0a3957d Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Wed, 23 Jan 2008 10:28:26 -0500 Subject: 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 --- .../CTest/cmCTestEmptyBinaryDirectoryCommand.cxx | 4 +- Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h | 3 +- Source/CTest/cmCTestHandlerCommand.cxx | 4 +- Source/CTest/cmCTestHandlerCommand.h | 3 +- Source/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 | 163 +++++++++++++-------- 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, 906 insertions(+), 359 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 5784656..02da485 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 f6bd9a3..0586bb0 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 da53d34..56baab6 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 69563e1..727437b 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 88d9b87..4feda89 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 cb870af..dd23d41 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 abb2e48..e01994d 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 949cb77..6a26567 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 c30e281..40926ad 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 11108e8..56747a8 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 37a6c88..dcc1026 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 01b48c2..2e20632 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 3962d03..103a14b 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 57edc9d..b01535f 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 6bff7c1..3161ef1 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 31dc2ac..1468894 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 1bd6757..dfb9b0c 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 f9da054..c988e63 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 d84f914..569ae70 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 ec35fe2..8e04704 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 1b2f8c6..eccf7d6 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 3c8147b..d876e7c 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 bc6a2c4..9914e17 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 5f4383a..daedc82 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 36d636b..4cc7e7a 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 e9d8f2f..6b0f7a4 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 72f5c51..00236e6 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 ca09858..813f30b 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 cf50401..6124ee2 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 22f4412..84e75d9 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 321dcef..1fc3467 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 538a8e8..f62bfd6 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 b713549..ac1471d 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 0000000..8647ce5 --- /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 0000000..010e18d --- /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 fd3760c..9977b1d 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 049d654..b2c6b22 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 362c88f..76d5bd5 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 c60fc19..578f027 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 f9ddd57..9a1417f 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 736e487..0fdd408 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 e57519b..04257cb 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 3111d46..e7c0fc6 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 aa337e5..2a8d3a4 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 78485cd..e35730a 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 4d542c9..e3fb4ec 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 607b66f..88df169 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 f0bd7d8..685f50d 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 5da7b34..4f95d46 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 939f7d8..4305b5c 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 41b5bf9..689e9b9 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 41b55b2..a296f01 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 2d251e4..7892499 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 2713b62..b1e5622 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 242e47c..937a804 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 3d94ba8..4a256e2 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 6f47f21..2ff8042 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 717e44d..13ce40b 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 03e1ef2..92fcc50 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 353be46..99ab1e2 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 2751c0f..f1e64d4 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 8fe3a1b..207d567 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 846e991..ffa6cbc 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 a2ba862..055ab32 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 d0b0982..0cd24ad 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 4a49dde..da48e89 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 da0a917..e635ecd 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 3acf36a..4eb3937 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 a16c8f7..97210e5 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 c437ac9..3b09e48 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 8564e2b..2d55043 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 0000000..66a567e --- /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 523528d..3dca7d8 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 199a128..c79f46d 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 6720c3e..4a49696 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 ac09184..6fa92d0 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 43c4494..8090eb1 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 b383a91..4815534 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 c03bf71..4ab73db 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 2fed8af..a69844a 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 45eb539..f1bce09 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 aa4e46c..233f766 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 247282b..3187432 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 7090eee..53d749c 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 6280187..c04594a 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 f4a4f01..1baceca 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 318dc13..c2b7ca7 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 79494f3..99b0dc9 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 1f9b84c..848c6a4 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -17,9 +17,10 @@ #include "cmForEachCommand.h" bool cmForEachFunctionBlocker:: -IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) +IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, + cmExecutionStatus &inStatus) { - // Prevent recusion and don't let this blobker block its own + // Prevent recusion and don't let this blocker block its own // commands. if (this->Executing) { @@ -54,9 +55,26 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) // set the variable to the loop value mf.AddDefinition(this->Args[0].c_str(),j->c_str()); // Invoke all the functions that were collected in the block. + cmExecutionStatus status; for(unsigned int c = 0; c < this->Functions.size(); ++c) { - mf.ExecuteCommand(this->Functions[c]); + status.Clear(); + mf.ExecuteCommand(this->Functions[c],status); + if (status.GetReturnInvoked()) + { + inStatus.SetReturnInvoked(true); + // restore the variable to its prior value + mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); + mf.RemoveFunctionBlocker(lff); + return true; + } + if (status.GetBreakInvoked()) + { + // restore the variable to its prior value + mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); + mf.RemoveFunctionBlocker(lff); + return true; + } } } // restore the variable to its prior value @@ -105,7 +123,8 @@ ScopeEnded(cmMakefile &mf) mf.GetCurrentDirectory()); } -bool cmForEachCommand::InitialPass(std::vector 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 0e21094..6ef217a 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 c9ba96d..a169cc1 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 5828cdd..1ff9d59 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 36be51f..aff4792 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 21ef549..09e7068 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 b0c6b13..c1f66d9 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 dd6affd..113886f 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 2e3085e..542cf4c 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 7bd5ac9..d06efe8 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 b87ebff..66e958f 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 2649cb6..0a37b97 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 f7c8ece..0df2371 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 366ff16..a291a0c 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 7393548..81fd49d 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 e0e85bd..963e16a 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 64ab8d3..820fdec 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 d4cae24..3b6503d 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 46588a4..c271a45 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 f5bd6cc..bc82c42 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->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")) + this->ScopeDepth--; + // if this is the endif for this if statement, then start executing + if (!this->ScopeDepth) { - 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")) + { + scopeDepth++; + } + if (!cmSystemTools::Strucmp(this->Functions[c].Name.c_str(),"endif")) + { + scopeDepth--; + } + // watch for our state change + if (scopeDepth == 0 && + !cmSystemTools::Strucmp(this->Functions[c].Name.c_str(),"else")) { - std::string err = "had incorrect arguments: "; - unsigned int i; - for(i =0; i < lff.Arguments.size(); ++i) + this->IsBlocking = this->HasRun; + this->HasRun = true; + } + else if (scopeDepth == 0 && !cmSystemTools::Strucmp + (this->Functions[c].Name.c_str(),"elseif")) + { + if (this->HasRun) { - err += (lff.Arguments[i].Quoted?"\"":""); - err += lff.Arguments[i].Value; - err += (lff.Arguments[i].Quoted?"\"":""); - err += " "; + this->IsBlocking = true; } - err += "("; - err += errorString; - err += ")."; - cmSystemTools::Error(err.c_str()); - delete [] errorString; - return false; - } + 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) + if (isTrue) + { + this->IsBlocking = false; + this->HasRun = true; + } + } + } + + // should we execute? + else if (!this->IsBlocking) { - this->IsBlocking = false; - this->HasRun = true; - return true; + 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 9ba4434..ca729e7 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 8b63fe9..2e85b24 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 b6a21d9..aaeea39 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 73f2e12..2d3271e 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 7eaf870..d51af5c 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 d4c4c80..d1f2a78 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 780ab04..c8b7e36 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 f94b971..8b0ff7a 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 699574b..b0bd2f6 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 c04a682..915cd4b 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 15332ae..f0f69e0 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 48d3e70..4b09ace 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 7885d18..6262833 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 a26b6ae..8a29665 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 81800ef..04fbb07 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 246b118..d3ecddf 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 e98b831..c6c8657 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 5eeb5bb..81b8945 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 fe08656..7f37ebf 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 94f0051..b9e7a8f 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 a7e9962..0953bdb 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 b7519ab..f990ad5 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 b5193b5..d607b42 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 062a7a6..0a8d3e6 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 e19c35b..4574a90 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 fe73ee8..fe67443 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 e63b9f1..c654c6d 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 f5c4187..6b92763 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 01396c3..4fcd597 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 3696296..6b1459e 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 db6b113..77f230f 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 6e99c17..151ad5e 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 201a507..6bc8067 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 "cmSystemTools.h" -#include "cmTarget.h" +#include "cmExecutionStatus.h" #include "cmListFileCache.h" -#include "cmCacheManager.h" #include "cmPropertyMap.h" +#include "cmSystemTools.h" +#include "cmTarget.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 93a8437..841b34c 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 7388285..62923c7 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 6c8f7a2..c7dde3a 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 9f0d23c..08504d8 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 f77cfd5..26d9012 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 02c5c23..54cccd4 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 46bf045..0c70411 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 c93c39e..b9fa01e 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 e15fea2..98dfabc 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 da18446..4241b2e 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 31d878a..1823b5f 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 11e297e..4e9b289 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 6348d92..991f29a 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 98aeec0..814aab9 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 ff86ed9..b8da0ff 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 491f175..7f0101d 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 94388c0..b44d299 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 10766a9..6490e7c 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 7641171..f39dac0 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 8ee5086..52d50fb 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 0000000..b134d82 --- /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 0000000..f10a5fd --- /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 5f3d88d..6e015b7 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 0bc87ef..827f7f2 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 082dd41..512ae95 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 6f6ecd2..e818d6a 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 2133309..2f34421 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 039f21a..aed9f67 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 933a3e8..0922c1d 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 06d4da5..a6d3966 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 5e7618d..9c6153b 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 fad76ee..e210de2 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 4fb2fb9..ccbe0d5 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 bc48a70..e9ff1ce 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 0d4c3fc..8a849b3 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 8717d90..e25b0a5 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 7e2e87e..ef29638 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 7c03268..6d46eec 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 97385c9..b21cada 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 5d56bf7..c4edf87 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 7ef39af..df32afc 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 f0b7c9e..3fa8a83 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 48b558d..f932ebc 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 bf21ab5..1e79bd8 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 bcb3d9b..c3250e4 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 4a1ca22..0e7bbc6 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 2b649b1..8c06e07 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 d84faa6..1e2cac1 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 a48f723..b286e76 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 27a65ab..2a45b49 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 e6b872d..e7dff78 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 0a86486..a839fe4 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 0e73cef..63ca142 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 8c38ab6..971d926 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 8485bfd..f8683ce 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 4fd0474..921c455 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 b119c94..69b50db 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 75e6367..f953bdc 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 8c5ed31..a5ee70c 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 db7a4d0..61d6226 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 e4e17d9..9684221 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 a934db4..c95df73 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 08d02b8..8afd758 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 643f949..0c69dd8 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. -- cgit v0.12