diff options
author | Ken Martin <ken.martin@kitware.com> | 2008-01-23 10:28:26 -0500 |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2008-01-23 10:28:26 -0500 |
commit | 0e69d38004787f1d55eb7188cde4cf45e0a3957d (patch) | |
tree | 6cde7d0b5ef4b0b9b6d4fc90db463418e073776b /Source | |
parent | 72a301f88008c3d98c4ae1f263084763dc662b31 (diff) | |
download | cmake-0e69d38004787f1d55eb7188cde4cf45e0a3957d.tar.gz |
ENH: add return and break support to cmake, also change basic command invocation signature to be able to return extra informaiton via the cmExecutionStatus class
Diffstat (limited to 'Source')
205 files changed, 906 insertions, 359 deletions
diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx index 57846568eb..02da485859 100644 --- a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx +++ b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.cxx @@ -18,8 +18,8 @@ #include "cmCTestScriptHandler.h" -bool cmCTestEmptyBinaryDirectoryCommand::InitialPass( - std::vector<std::string> const& args) +bool cmCTestEmptyBinaryDirectoryCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() != 1 ) { diff --git a/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h b/Source/CTest/cmCTestEmptyBinaryDirectoryCommand.h index f6bd9a3a87..0586bb044d 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/CTest/cmCTestHandlerCommand.cxx b/Source/CTest/cmCTestHandlerCommand.cxx index da53d34010..56baab60fc 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<std::string> const& args) +bool cmCTestHandlerCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if ( !this->ProcessArguments(args, (unsigned int)this->Last, &*this->Arguments.begin(),this->Values) ) diff --git a/Source/CTest/cmCTestHandlerCommand.h b/Source/CTest/cmCTestHandlerCommand.h index 69563e1b97..727437b419 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); cmTypeMacro(cmCTestHandlerCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.cxx b/Source/CTest/cmCTestReadCustomFilesCommand.cxx index 88d9b8766f..4feda8922b 100644 --- a/Source/CTest/cmCTestReadCustomFilesCommand.cxx +++ b/Source/CTest/cmCTestReadCustomFilesCommand.cxx @@ -18,8 +18,8 @@ #include "cmCTest.h" -bool cmCTestReadCustomFilesCommand::InitialPass( - std::vector<std::string> const& args) +bool cmCTestReadCustomFilesCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if (args.size() < 1) { diff --git a/Source/CTest/cmCTestReadCustomFilesCommand.h b/Source/CTest/cmCTestReadCustomFilesCommand.h index cb870af6a8..dd23d41012 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx index abb2e48cfd..e01994dde9 100644 --- a/Source/CTest/cmCTestRunScriptCommand.cxx +++ b/Source/CTest/cmCTestRunScriptCommand.cxx @@ -18,8 +18,8 @@ #include "cmCTestScriptHandler.h" -bool cmCTestRunScriptCommand::InitialPass( - std::vector<std::string> const& args) +bool cmCTestRunScriptCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/CTest/cmCTestRunScriptCommand.h b/Source/CTest/cmCTestRunScriptCommand.h index 949cb77e0e..6a26567b54 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index c30e2818eb..40926adbd6 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 11108e82bd..56747a88b2 100644 --- a/Source/CTest/cmCTestSleepCommand.cxx +++ b/Source/CTest/cmCTestSleepCommand.cxx @@ -19,8 +19,8 @@ #include "cmCTestScriptHandler.h" #include <stdlib.h> // required for atoi -bool cmCTestSleepCommand::InitialPass( - std::vector<std::string> const& args) +bool cmCTestSleepCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if (args.size() < 1) { diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index 37a6c8819d..dcc1026680 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx index 01b48c226b..2e20632c8b 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<std::string> const& args) +bool cmCTestStartCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if (args.size() < 1) { diff --git a/Source/CTest/cmCTestStartCommand.h b/Source/CTest/cmCTestStartCommand.h index 3962d039e9..103a14b09d 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 57edc9dbcc..b01535fcda 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &); /** * The name of the command as specified in CMakeList.txt. @@ -70,7 +71,8 @@ public: }; //---------------------------------------------------------------------- -bool cmCTestSubdirCommand::InitialPass(std::vector<std::string> const& args) +bool cmCTestSubdirCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { @@ -139,7 +141,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &); /** * The name of the command as specified in CMakeList.txt. @@ -157,7 +160,7 @@ public: //---------------------------------------------------------------------- bool cmCTestAddSubdirectoryCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { @@ -223,7 +226,8 @@ public: * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector<std::string> const&); + virtual bool InitialPass(std::vector<std::string> const&, + cmExecutionStatus &); /** * The name of the command as specified in CMakeList.txt. @@ -240,7 +244,8 @@ public: }; //---------------------------------------------------------------------- -bool cmCTestAddTestCommand::InitialPass(std::vector<std::string> const& args) +bool cmCTestAddTestCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if ( args.size() < 2 ) { @@ -268,8 +273,9 @@ public: /** * This is called when the command is first encountered in * the CMakeLists.txt file. - */ - virtual bool InitialPass(std::vector<std::string> const&); + */ + virtual bool InitialPass(std::vector<std::string> const&, + cmExecutionStatus &); /** * The name of the command as specified in CMakeList.txt. @@ -286,8 +292,8 @@ public: }; //---------------------------------------------------------------------- -bool cmCTestSetTestsPropertiesCommand::InitialPass( - std::vector<std::string> const& args) +bool cmCTestSetTestsPropertiesCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { return this->TestHandler->SetTestsProperties(args); } diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index 6bff7c107e..3161ef17d2 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -21,8 +21,8 @@ #include "cmSourceFile.h" // cmAddCustomCommandCommand -bool cmAddCustomCommandCommand::InitialPass( - std::vector<std::string> const& args) +bool cmAddCustomCommandCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { /* Let's complain at the end of this function about the lack of a particular arg. For the moment, let's say that COMMAND, and either TARGET or SOURCE diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index 31dc2ac749..14688942c9 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddCustomTargetCommand.cxx b/Source/cmAddCustomTargetCommand.cxx index 1bd6757b3b..dfb9b0ce48 100644 --- a/Source/cmAddCustomTargetCommand.cxx +++ b/Source/cmAddCustomTargetCommand.cxx @@ -17,8 +17,8 @@ #include "cmAddCustomTargetCommand.h" // cmAddCustomTargetCommand -bool cmAddCustomTargetCommand::InitialPass( - std::vector<std::string> const& args) +bool cmAddCustomTargetCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmAddCustomTargetCommand.h b/Source/cmAddCustomTargetCommand.h index f9da05443f..c988e6372c 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddDefinitionsCommand.cxx b/Source/cmAddDefinitionsCommand.cxx index d84f9142cb..569ae70b9c 100644 --- a/Source/cmAddDefinitionsCommand.cxx +++ b/Source/cmAddDefinitionsCommand.cxx @@ -17,8 +17,8 @@ #include "cmAddDefinitionsCommand.h" // cmAddDefinitionsCommand -bool cmAddDefinitionsCommand::InitialPass( - std::vector<std::string> const& args) +bool cmAddDefinitionsCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { // it is OK to have no arguments if(args.size() < 1 ) diff --git a/Source/cmAddDefinitionsCommand.h b/Source/cmAddDefinitionsCommand.h index ec35fe223c..8e04704ad5 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index 1b2f8c6483..eccf7d6881 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -19,8 +19,8 @@ #include "cmGlobalGenerator.h" // cmDependenciesCommand -bool cmAddDependenciesCommand::InitialPass( - std::vector<std::string> const& args) +bool cmAddDependenciesCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index 3c8147b269..d876e7c797 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddExecutableCommand.cxx b/Source/cmAddExecutableCommand.cxx index bc6a2c417d..9914e171de 100644 --- a/Source/cmAddExecutableCommand.cxx +++ b/Source/cmAddExecutableCommand.cxx @@ -17,7 +17,8 @@ #include "cmAddExecutableCommand.h" // cmExecutableCommand -bool cmAddExecutableCommand::InitialPass(std::vector<std::string> const& args) +bool cmAddExecutableCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmAddExecutableCommand.h b/Source/cmAddExecutableCommand.h index 5f4383a71e..daedc82ab1 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddLibraryCommand.cxx b/Source/cmAddLibraryCommand.cxx index 36d636b560..4cc7e7ae3f 100644 --- a/Source/cmAddLibraryCommand.cxx +++ b/Source/cmAddLibraryCommand.cxx @@ -19,7 +19,8 @@ #include "cmake.h" // cmLibraryCommand -bool cmAddLibraryCommand::InitialPass(std::vector<std::string> const& args) +bool cmAddLibraryCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index e9d8f2f07b..6b0f7a494b 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddSubDirectoryCommand.cxx b/Source/cmAddSubDirectoryCommand.cxx index 72f5c51ce5..00236e6209 100644 --- a/Source/cmAddSubDirectoryCommand.cxx +++ b/Source/cmAddSubDirectoryCommand.cxx @@ -18,7 +18,7 @@ // cmAddSubDirectoryCommand bool cmAddSubDirectoryCommand::InitialPass -(std::vector<std::string> const& args) +(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmAddSubDirectoryCommand.h b/Source/cmAddSubDirectoryCommand.h index ca09858e2c..813f30bca1 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx index cf50401c0b..6124ee2af4 100644 --- a/Source/cmAddTestCommand.cxx +++ b/Source/cmAddTestCommand.cxx @@ -20,7 +20,8 @@ // cmExecutableCommand -bool cmAddTestCommand::InitialPass(std::vector<std::string> const& args) +bool cmAddTestCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { // First argument is the name of the test Second argument is the name of // the executable to run (a target or external program) Remaining arguments diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index 22f4412409..84e75d9214 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmAuxSourceDirectoryCommand.cxx b/Source/cmAuxSourceDirectoryCommand.cxx index 321dcef96c..1fc3467fd0 100644 --- a/Source/cmAuxSourceDirectoryCommand.cxx +++ b/Source/cmAuxSourceDirectoryCommand.cxx @@ -21,7 +21,7 @@ // cmAuxSourceDirectoryCommand bool cmAuxSourceDirectoryCommand::InitialPass -(std::vector<std::string> const& args) +(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 || args.size() > 2) { diff --git a/Source/cmAuxSourceDirectoryCommand.h b/Source/cmAuxSourceDirectoryCommand.h index 538a8e8444..f62bfd6cca 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx index b713549b6d..ac1471de13 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<cmCommand*>& commands) commands.push_back(new cmAddLibraryCommand); commands.push_back(new cmAddSubDirectoryCommand); commands.push_back(new cmAddTestCommand); + commands.push_back(new cmBreakCommand); commands.push_back(new cmBuildCommand); commands.push_back(new cmCMakeMinimumRequired); commands.push_back(new cmConfigureFileCommand); @@ -129,6 +132,7 @@ void GetBootstrapCommands(std::list<cmCommand*>& commands) commands.push_back(new cmMessageCommand); commands.push_back(new cmOptionCommand); commands.push_back(new cmProjectCommand); + commands.push_back(new cmReturnCommand); commands.push_back(new cmSetCommand); commands.push_back(new cmSetPropertyCommand); commands.push_back(new cmSetSourceFilesPropertiesCommand); diff --git a/Source/cmBreakCommand.cxx b/Source/cmBreakCommand.cxx new file mode 100644 index 0000000000..8647ce562f --- /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<std::string> const&, + cmExecutionStatus &status) +{ + status.SetBreakInvoked(true); + return true; +} + diff --git a/Source/cmBreakCommand.h b/Source/cmBreakCommand.h new file mode 100644 index 0000000000..010e18d256 --- /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<std::string> const& args, + cmExecutionStatus &status); + + /** + * This determines if the command is invoked when in script mode. + */ + virtual bool IsScriptable() { return true; } + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() {return "break";} + + /** + * Succinct documentation. + */ + virtual const char* GetTerseDocumentation() + { + return "Break from an enclosing foreach or while loop."; + } + + /** + * More documentation. + */ + virtual const char* GetFullDocumentation() + { + return + " break()\n" + "Breaks from an enclosing foreach loop or while loop"; + } + + cmTypeMacro(cmBreakCommand, cmCommand); +}; + + + +#endif diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx index fd3760c5ef..9977b1d8d9 100644 --- a/Source/cmBuildCommand.cxx +++ b/Source/cmBuildCommand.cxx @@ -20,7 +20,8 @@ #include "cmGlobalGenerator.h" // cmBuildCommand -bool cmBuildCommand::InitialPass(std::vector<std::string> const& args) +bool cmBuildCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmBuildCommand.h b/Source/cmBuildCommand.h index 049d6543b5..b2c6b22fd1 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmBuildNameCommand.cxx b/Source/cmBuildNameCommand.cxx index 362c88f911..76d5bd5bda 100644 --- a/Source/cmBuildNameCommand.cxx +++ b/Source/cmBuildNameCommand.cxx @@ -19,7 +19,8 @@ #include <cmsys/RegularExpression.hxx> // cmBuildNameCommand -bool cmBuildNameCommand::InitialPass(std::vector<std::string> const& args) +bool cmBuildNameCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmBuildNameCommand.h b/Source/cmBuildNameCommand.h index c60fc19d03..578f027502 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmCMakeMinimumRequired.cxx b/Source/cmCMakeMinimumRequired.cxx index f9ddd5742a..9a1417f9c5 100644 --- a/Source/cmCMakeMinimumRequired.cxx +++ b/Source/cmCMakeMinimumRequired.cxx @@ -19,7 +19,8 @@ #include "cmVersion.h" // cmCMakeMinimumRequired -bool cmCMakeMinimumRequired::InitialPass(std::vector<std::string> const& args) +bool cmCMakeMinimumRequired +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { // Process arguments. std::string version_string; diff --git a/Source/cmCMakeMinimumRequired.h b/Source/cmCMakeMinimumRequired.h index 736e4878d3..0fdd40866f 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index e57519b507..04257cb3b7 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 3111d46f86..e7c0fc67c9 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<cmListFileArgument>& args) + virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args, + cmExecutionStatus &status) { std::vector<std::string> expandedArguments; this->Makefile->ExpandArguments(args, expandedArguments); - return this->InitialPass(expandedArguments); + return this->InitialPass(expandedArguments,status); } /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector<std::string> const& args) = 0; + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &) = 0; /** * This is called at the end after all the information diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index aa337e503f..2a8d3a4d18 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -19,7 +19,8 @@ #include <cmsys/RegularExpression.hxx> // cmConfigureFileCommand -bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args) +bool cmConfigureFileCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmConfigureFileCommand.h b/Source/cmConfigureFileCommand.h index 78485cd3b1..e35730a4b9 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmCreateTestSourceList.cxx b/Source/cmCreateTestSourceList.cxx index 4d542c9d99..e3fb4ecc29 100644 --- a/Source/cmCreateTestSourceList.cxx +++ b/Source/cmCreateTestSourceList.cxx @@ -18,7 +18,8 @@ #include "cmSourceFile.h" // cmCreateTestSourceList -bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& args) +bool cmCreateTestSourceList +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if (args.size() < 3) { diff --git a/Source/cmCreateTestSourceList.h b/Source/cmCreateTestSourceList.h index 607b66f58d..88df169cbe 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx index f0bd7d875a..685f50d625 100644 --- a/Source/cmDefinePropertyCommand.cxx +++ b/Source/cmDefinePropertyCommand.cxx @@ -18,8 +18,8 @@ #include "cmake.h" // cmDefinePropertiesCommand -bool cmDefinePropertyCommand::InitialPass( - std::vector<std::string> const& args) +bool cmDefinePropertyCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 5 ) { diff --git a/Source/cmDefinePropertyCommand.h b/Source/cmDefinePropertyCommand.h index 5da7b343a0..4f95d46661 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmElseCommand.cxx b/Source/cmElseCommand.cxx index 939f7d899c..4305b5ccf5 100644 --- a/Source/cmElseCommand.cxx +++ b/Source/cmElseCommand.cxx @@ -16,7 +16,8 @@ =========================================================================*/ #include "cmElseCommand.h" -bool cmElseCommand::InitialPass(std::vector<std::string> const&) +bool cmElseCommand::InitialPass(std::vector<std::string> const&, + cmExecutionStatus &) { this->SetError("An ELSE command was found outside of a proper " "IF ENDIF structure. Or its arguments did not match " diff --git a/Source/cmElseCommand.h b/Source/cmElseCommand.h index 41b5bf991c..689e9b9377 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmElseIfCommand.cxx b/Source/cmElseIfCommand.cxx index 41b55b2c87..a296f0163d 100644 --- a/Source/cmElseIfCommand.cxx +++ b/Source/cmElseIfCommand.cxx @@ -16,7 +16,8 @@ =========================================================================*/ #include "cmElseIfCommand.h" -bool cmElseIfCommand::InitialPass(std::vector<std::string> const&) +bool cmElseIfCommand::InitialPass(std::vector<std::string> const&, + cmExecutionStatus &) { this->SetError("An ELSEIF command was found outside of a proper " "IF ENDIF structure."); diff --git a/Source/cmElseIfCommand.h b/Source/cmElseIfCommand.h index 2d251e4300..78924991c4 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEnableLanguageCommand.cxx b/Source/cmEnableLanguageCommand.cxx index 2713b623bd..b1e5622fea 100644 --- a/Source/cmEnableLanguageCommand.cxx +++ b/Source/cmEnableLanguageCommand.cxx @@ -18,7 +18,7 @@ // cmEnableLanguageCommand bool cmEnableLanguageCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { bool optional = false; std::vector<std::string> languages; diff --git a/Source/cmEnableLanguageCommand.h b/Source/cmEnableLanguageCommand.h index 242e47cdf5..937a80440c 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx index 3d94ba8e50..4a256e2f7a 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<std::string> const&) +bool cmEnableTestingCommand::InitialPass(std::vector<std::string> const&, + cmExecutionStatus &) { this->Makefile->AddDefinition("CMAKE_TESTING_ENABLED","1"); return true; diff --git a/Source/cmEnableTestingCommand.h b/Source/cmEnableTestingCommand.h index 6f47f21b8b..2ff804221d 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<std::string> const&); + virtual bool InitialPass(std::vector<std::string> const&, + cmExecutionStatus &); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmEndForEachCommand.cxx b/Source/cmEndForEachCommand.cxx index 717e44d257..13ce40b545 100644 --- a/Source/cmEndForEachCommand.cxx +++ b/Source/cmEndForEachCommand.cxx @@ -17,7 +17,8 @@ #include "cmEndForEachCommand.h" bool cmEndForEachCommand -::InvokeInitialPass(std::vector<cmListFileArgument> const&) +::InvokeInitialPass(std::vector<cmListFileArgument> const&, + cmExecutionStatus &) { this->SetError("An ENDFOREACH command was found outside of a proper " "FOREACH ENDFOREACH structure. Or its arguments did " diff --git a/Source/cmEndForEachCommand.h b/Source/cmEndForEachCommand.h index 03e1ef2eb0..92fcc503ab 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<cmListFileArgument> const&); + virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&, + cmExecutionStatus &); /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector<std::string> const&) {return false;} + virtual bool InitialPass(std::vector<std::string> const&, + cmExecutionStatus &) {return false;} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndFunctionCommand.cxx b/Source/cmEndFunctionCommand.cxx index 353be465da..99ab1e2bc6 100644 --- a/Source/cmEndFunctionCommand.cxx +++ b/Source/cmEndFunctionCommand.cxx @@ -17,7 +17,8 @@ #include "cmEndFunctionCommand.h" bool cmEndFunctionCommand -::InvokeInitialPass(std::vector<cmListFileArgument> const&) +::InvokeInitialPass(std::vector<cmListFileArgument> const&, + cmExecutionStatus &) { this->SetError("An ENDFUNCTION command was found outside of a proper " "FUNCTION ENDFUNCTION structure. Or its arguments did not " diff --git a/Source/cmEndFunctionCommand.h b/Source/cmEndFunctionCommand.h index 2751c0feec..f1e64d45ef 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<cmListFileArgument> const&); + virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&, + cmExecutionStatus &); /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector<std::string> const&) {return false;} + virtual bool InitialPass(std::vector<std::string> const&, + cmExecutionStatus &) {return false;} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndIfCommand.cxx b/Source/cmEndIfCommand.cxx index 8fe3a1b528..207d56775e 100644 --- a/Source/cmEndIfCommand.cxx +++ b/Source/cmEndIfCommand.cxx @@ -16,7 +16,8 @@ =========================================================================*/ #include "cmEndIfCommand.h" #include <stdlib.h> // required for atof -bool cmEndIfCommand::InitialPass(std::vector<std::string> const&) +bool cmEndIfCommand::InitialPass(std::vector<std::string> const&, + cmExecutionStatus &) { const char* versionValue = this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION"); diff --git a/Source/cmEndIfCommand.h b/Source/cmEndIfCommand.h index 846e991afa..ffa6cbc9cd 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndMacroCommand.cxx b/Source/cmEndMacroCommand.cxx index a2ba862605..055ab32632 100644 --- a/Source/cmEndMacroCommand.cxx +++ b/Source/cmEndMacroCommand.cxx @@ -17,7 +17,8 @@ #include "cmEndMacroCommand.h" bool cmEndMacroCommand -::InvokeInitialPass(std::vector<cmListFileArgument> const&) +::InvokeInitialPass(std::vector<cmListFileArgument> const&, + cmExecutionStatus &) { this->SetError("An ENDMACRO command was found outside of a proper " "MACRO ENDMACRO structure. Or its arguments did not " diff --git a/Source/cmEndMacroCommand.h b/Source/cmEndMacroCommand.h index d0b0982f9f..0cd24add92 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<cmListFileArgument> const&); + virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&, + cmExecutionStatus &); /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector<std::string> const&) {return false;} + virtual bool InitialPass(std::vector<std::string> const&, + cmExecutionStatus &) {return false;} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmEndWhileCommand.cxx b/Source/cmEndWhileCommand.cxx index 4a49ddedbb..da48e892ea 100644 --- a/Source/cmEndWhileCommand.cxx +++ b/Source/cmEndWhileCommand.cxx @@ -17,7 +17,8 @@ #include "cmEndWhileCommand.h" bool cmEndWhileCommand -::InvokeInitialPass(std::vector<cmListFileArgument> const&) +::InvokeInitialPass(std::vector<cmListFileArgument> const&, + cmExecutionStatus &) { this->SetError("An ENDWHILE command was found outside of a proper " "WHILE ENDWHILE structure. Or its arguments did not " diff --git a/Source/cmEndWhileCommand.h b/Source/cmEndWhileCommand.h index da0a917120..e635ecd98f 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<cmListFileArgument> const&); + virtual bool InvokeInitialPass(std::vector<cmListFileArgument> const&, + cmExecutionStatus &status); /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector<std::string> const&) {return false;} + virtual bool InitialPass(std::vector<std::string> const&, + cmExecutionStatus &) {return false;} /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmExecProgramCommand.cxx b/Source/cmExecProgramCommand.cxx index 3acf36a0ef..4eb3937bd3 100644 --- a/Source/cmExecProgramCommand.cxx +++ b/Source/cmExecProgramCommand.cxx @@ -18,7 +18,8 @@ #include "cmSystemTools.h" // cmExecProgramCommand -bool cmExecProgramCommand::InitialPass(std::vector<std::string> const& args) +bool cmExecProgramCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmExecProgramCommand.h b/Source/cmExecProgramCommand.h index a16c8f7d4c..97210e5bc7 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx index c437ac91c1..3b09e484cd 100644 --- a/Source/cmExecuteProcessCommand.cxx +++ b/Source/cmExecuteProcessCommand.cxx @@ -33,7 +33,7 @@ void cmExecuteProcessCommandAppend(std::vector<char>& output, // cmExecuteProcessCommand bool cmExecuteProcessCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmExecuteProcessCommand.h b/Source/cmExecuteProcessCommand.h index 8564e2b098..2d550438a4 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmExecutionStatus.h b/Source/cmExecutionStatus.h new file mode 100644 index 0000000000..66a567ebd3 --- /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 523528d76b..3dca7d8cfc 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -39,7 +39,7 @@ cmExportCommand::cmExportCommand() // cmExportCommand bool cmExportCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index 199a128a46..c79f46d20b 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx index 6720c3e404..4a49696b92 100644 --- a/Source/cmExportLibraryDependencies.cxx +++ b/Source/cmExportLibraryDependencies.cxx @@ -23,7 +23,7 @@ #include <cmsys/auto_ptr.hxx> bool cmExportLibraryDependenciesCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmExportLibraryDependencies.h b/Source/cmExportLibraryDependencies.h index ac091840e5..6fa92d0b94 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This is called at the end after all the information diff --git a/Source/cmFLTKWrapUICommand.cxx b/Source/cmFLTKWrapUICommand.cxx index 43c4494b2a..8090eb1e6d 100644 --- a/Source/cmFLTKWrapUICommand.cxx +++ b/Source/cmFLTKWrapUICommand.cxx @@ -19,7 +19,8 @@ #include "cmSourceFile.h" // cmFLTKWrapUICommand -bool cmFLTKWrapUICommand::InitialPass(std::vector<std::string> const& args) +bool cmFLTKWrapUICommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmFLTKWrapUICommand.h b/Source/cmFLTKWrapUICommand.h index b383a91e62..48155347d4 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This is called at the end after all the information diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index c03bf71ec3..4ab73db20b 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<std::string> const& args) +bool cmFileCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 2fed8afa68..a69844a769 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 45eb539c21..f1bce09b01 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -55,7 +55,8 @@ cmFindLibraryCommand::cmFindLibraryCommand() } // cmFindLibraryCommand -bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn) +bool cmFindLibraryCommand +::InitialPass(std::vector<std::string> const& argsIn, cmExecutionStatus &) { this->VariableDocumentation = "Path to a library."; this->CMakePathName = "LIBRARY"; diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index aa4e46cbf4..233f766a0d 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 247282b159..31874328d0 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -231,7 +231,8 @@ const char* cmFindPackageCommand::GetFullDocumentation() } //---------------------------------------------------------------------------- -bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) +bool cmFindPackageCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 7090eeeec4..53d749c885 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 628018772b..c04594ac6b 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -70,7 +70,8 @@ const char* cmFindPathCommand::GetFullDocumentation() } // cmFindPathCommand -bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn) +bool cmFindPathCommand +::InitialPass(std::vector<std::string> const& argsIn, cmExecutionStatus &) { this->VariableDocumentation = "Path to a file."; this->CMakePathName = "INCLUDE"; diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index f4a4f01a23..1baceca32d 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx index 318dc134b8..c2b7ca757c 100644 --- a/Source/cmFindProgramCommand.cxx +++ b/Source/cmFindProgramCommand.cxx @@ -51,7 +51,8 @@ cmFindProgramCommand::cmFindProgramCommand() } // cmFindProgramCommand -bool cmFindProgramCommand::InitialPass(std::vector<std::string> const& argsIn) +bool cmFindProgramCommand +::InitialPass(std::vector<std::string> const& argsIn, cmExecutionStatus &) { this->VariableDocumentation = "Path to a program."; this->CMakePathName = "PROGRAM"; diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h index 79494f3f56..99b0dc926f 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmForEachCommand.cxx b/Source/cmForEachCommand.cxx index 1f9b84cf8b..848c6a4fe7 100644 --- a/Source/cmForEachCommand.cxx +++ b/Source/cmForEachCommand.cxx @@ -17,9 +17,10 @@ #include "cmForEachCommand.h" bool cmForEachFunctionBlocker:: -IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) +IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, + cmExecutionStatus &inStatus) { - // Prevent recusion and don't let this blobker block its own + // Prevent recusion and don't let this blocker block its own // commands. if (this->Executing) { @@ -54,9 +55,26 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) // set the variable to the loop value mf.AddDefinition(this->Args[0].c_str(),j->c_str()); // Invoke all the functions that were collected in the block. + cmExecutionStatus status; for(unsigned int c = 0; c < this->Functions.size(); ++c) { - mf.ExecuteCommand(this->Functions[c]); + status.Clear(); + mf.ExecuteCommand(this->Functions[c],status); + if (status.GetReturnInvoked()) + { + inStatus.SetReturnInvoked(true); + // restore the variable to its prior value + mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); + mf.RemoveFunctionBlocker(lff); + return true; + } + if (status.GetBreakInvoked()) + { + // restore the variable to its prior value + mf.AddDefinition(this->Args[0].c_str(),oldDef.c_str()); + mf.RemoveFunctionBlocker(lff); + return true; + } } } // restore the variable to its prior value @@ -105,7 +123,8 @@ ScopeEnded(cmMakefile &mf) mf.GetCurrentDirectory()); } -bool cmForEachCommand::InitialPass(std::vector<std::string> const& args) +bool cmForEachCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmForEachCommand.h b/Source/cmForEachCommand.h index 0e21094773..6ef217a51c 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmFunctionBlocker.h b/Source/cmFunctionBlocker.h index c9ba96d346..a169cc1847 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 5828cdd85b..1ff9d59e14 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<cmListFileArgument>& args); + virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args, + cmExecutionStatus &); - virtual bool InitialPass(std::vector<std::string> const&) { return false; }; + virtual bool InitialPass(std::vector<std::string> const&, + cmExecutionStatus &) { return false; }; /** * The name of the command as specified in CMakeList.txt. @@ -83,7 +85,8 @@ public: bool cmFunctionHelperCommand::InvokeInitialPass -(const std::vector<cmListFileArgument>& args) +(const std::vector<cmListFileArgument>& args, + cmExecutionStatus &) { // Expand the argument list to the function. std::vector<std::string> expandedArgs; @@ -153,7 +156,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass // for each function for(unsigned int c = 0; c < this->Functions.size(); ++c) { - if (!this->Makefile->ExecuteCommand(this->Functions[c])) + cmExecutionStatus status; + if (!this->Makefile->ExecuteCommand(this->Functions[c],status)) { cmOStringStream error; error << "Error in cmake code at\n" @@ -167,6 +171,11 @@ bool cmFunctionHelperCommand::InvokeInitialPass this->Makefile->PopScope(); return false; } + if (status.GetReturnInvoked()) + { + this->Makefile->PopScope(); + return true; + } } // pop scope on the makefile @@ -175,7 +184,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass } bool cmFunctionFunctionBlocker:: -IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf) +IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, + cmExecutionStatus &) { // record commands until we hit the ENDFUNCTION // at the ENDFUNCTION call we shift gears and start looking for invocations @@ -266,7 +276,8 @@ ScopeEnded(cmMakefile &mf) this->Args[0].c_str()); } -bool cmFunctionCommand::InitialPass(std::vector<std::string> const& args) +bool cmFunctionCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmFunctionCommand.h b/Source/cmFunctionCommand.h index 36be51ffc0..aff4792248 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx index 21ef549e4d..09e7068173 100644 --- a/Source/cmGetCMakePropertyCommand.cxx +++ b/Source/cmGetCMakePropertyCommand.cxx @@ -19,8 +19,8 @@ #include "cmake.h" // cmGetCMakePropertyCommand -bool cmGetCMakePropertyCommand::InitialPass( - std::vector<std::string> const& args) +bool cmGetCMakePropertyCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmGetCMakePropertyCommand.h b/Source/cmGetCMakePropertyCommand.h index b0c6b13858..c1f66d990d 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmGetDirectoryPropertyCommand.cxx b/Source/cmGetDirectoryPropertyCommand.cxx index dd6affdfeb..113886f171 100644 --- a/Source/cmGetDirectoryPropertyCommand.cxx +++ b/Source/cmGetDirectoryPropertyCommand.cxx @@ -19,8 +19,8 @@ #include "cmake.h" // cmGetDirectoryPropertyCommand -bool cmGetDirectoryPropertyCommand::InitialPass( - std::vector<std::string> const& args) +bool cmGetDirectoryPropertyCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmGetDirectoryPropertyCommand.h b/Source/cmGetDirectoryPropertyCommand.h index 2e3085e9fc..542cf4c716 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 7bd5ac962d..d06efe88e0 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -19,7 +19,7 @@ // cmGetFilenameComponentCommand bool cmGetFilenameComponentCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 3) { diff --git a/Source/cmGetFilenameComponentCommand.h b/Source/cmGetFilenameComponentCommand.h index b87ebff755..66e958f4bb 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 2649cb68e5..0a37b97495 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -27,7 +27,8 @@ cmGetPropertyCommand::cmGetPropertyCommand() } //---------------------------------------------------------------------------- -bool cmGetPropertyCommand::InitialPass(std::vector<std::string> const& args) +bool cmGetPropertyCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 3 ) { diff --git a/Source/cmGetPropertyCommand.h b/Source/cmGetPropertyCommand.h index f7c8ece53f..0df2371e66 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmGetSourceFilePropertyCommand.cxx b/Source/cmGetSourceFilePropertyCommand.cxx index 366ff165a5..a291a0c2fd 100644 --- a/Source/cmGetSourceFilePropertyCommand.cxx +++ b/Source/cmGetSourceFilePropertyCommand.cxx @@ -19,8 +19,8 @@ #include "cmSourceFile.h" // cmSetSourceFilePropertyCommand -bool cmGetSourceFilePropertyCommand::InitialPass( - std::vector<std::string> const& args) +bool cmGetSourceFilePropertyCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() != 3 ) { diff --git a/Source/cmGetSourceFilePropertyCommand.h b/Source/cmGetSourceFilePropertyCommand.h index 7393548a2b..81fd49dd7d 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index e0e85bda8d..963e16ad5a 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -17,8 +17,8 @@ #include "cmGetTargetPropertyCommand.h" // cmSetTargetPropertyCommand -bool cmGetTargetPropertyCommand::InitialPass( - std::vector<std::string> const& args) +bool cmGetTargetPropertyCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() != 3 ) { diff --git a/Source/cmGetTargetPropertyCommand.h b/Source/cmGetTargetPropertyCommand.h index 64ab8d3476..820fdec912 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmGetTestPropertyCommand.cxx b/Source/cmGetTestPropertyCommand.cxx index d4cae2444f..3b6503d331 100644 --- a/Source/cmGetTestPropertyCommand.cxx +++ b/Source/cmGetTestPropertyCommand.cxx @@ -20,8 +20,8 @@ #include "cmTest.h" // cmGetTestPropertyCommand -bool cmGetTestPropertyCommand::InitialPass( - std::vector<std::string> const& args) +bool cmGetTestPropertyCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 3 ) { diff --git a/Source/cmGetTestPropertyCommand.h b/Source/cmGetTestPropertyCommand.h index 46588a446e..c271a45826 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index f5bd6cc13e..bc82c42651 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -22,89 +22,122 @@ #include <cmsys/RegularExpression.hxx> 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<std::string> 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<std::string> 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<cmListFileArgument>& args) +::InvokeInitialPass(const std::vector<cmListFileArgument>& 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 9ba4434d99..ca729e79b1 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<cmListFileArgument> Args; + std::vector<cmListFileFunction> 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<cmListFileArgument>& args); + virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args, + cmExecutionStatus &); /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector<std::string> const&) { return false; } + virtual bool InitialPass(std::vector<std::string> const&, + cmExecutionStatus &) { return false;}; /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmIncludeCommand.cxx b/Source/cmIncludeCommand.cxx index 8b63fe9706..2e85b24047 100644 --- a/Source/cmIncludeCommand.cxx +++ b/Source/cmIncludeCommand.cxx @@ -18,7 +18,8 @@ // cmIncludeCommand -bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args) +bool cmIncludeCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if (args.size()< 1 || args.size() > 4) { diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h index b6a21d993a..aaeea395ad 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmIncludeDirectoryCommand.cxx b/Source/cmIncludeDirectoryCommand.cxx index 73f2e12530..2d3271ee2f 100644 --- a/Source/cmIncludeDirectoryCommand.cxx +++ b/Source/cmIncludeDirectoryCommand.cxx @@ -18,7 +18,7 @@ // cmIncludeDirectoryCommand bool cmIncludeDirectoryCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmIncludeDirectoryCommand.h b/Source/cmIncludeDirectoryCommand.h index 7eaf8703c6..d51af5cb8f 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmIncludeExternalMSProjectCommand.cxx b/Source/cmIncludeExternalMSProjectCommand.cxx index d4c4c80e43..d1f2a78aea 100644 --- a/Source/cmIncludeExternalMSProjectCommand.cxx +++ b/Source/cmIncludeExternalMSProjectCommand.cxx @@ -18,7 +18,7 @@ // cmIncludeExternalMSProjectCommand bool cmIncludeExternalMSProjectCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2) { diff --git a/Source/cmIncludeExternalMSProjectCommand.h b/Source/cmIncludeExternalMSProjectCommand.h index 780ab04bf5..c8b7e36f1f 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmIncludeRegularExpressionCommand.cxx b/Source/cmIncludeRegularExpressionCommand.cxx index f94b971173..8b0ff7a683 100644 --- a/Source/cmIncludeRegularExpressionCommand.cxx +++ b/Source/cmIncludeRegularExpressionCommand.cxx @@ -18,7 +18,7 @@ // cmIncludeRegularExpressionCommand bool cmIncludeRegularExpressionCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if((args.size() < 1) || (args.size() > 2)) { diff --git a/Source/cmIncludeRegularExpressionCommand.h b/Source/cmIncludeRegularExpressionCommand.h index 699574be87..b0bd2f602e 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index c04a682b72..915cd4b3f7 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -46,7 +46,8 @@ static cmInstallFilesGenerator* CreateInstallFilesGenerator( // cmInstallCommand -bool cmInstallCommand::InitialPass(std::vector<std::string> const& args) +bool cmInstallCommand::InitialPass(std::vector<std::string> 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 15332ae8ba..f0f69e0493 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx index 48d3e70369..4b09aceed7 100644 --- a/Source/cmInstallFilesCommand.cxx +++ b/Source/cmInstallFilesCommand.cxx @@ -20,7 +20,7 @@ // cmExecutableCommand bool cmInstallFilesCommand -::InitialPass(std::vector<std::string> const& argsIn) +::InitialPass(std::vector<std::string> const& argsIn, cmExecutionStatus &) { if(argsIn.size() < 2) { diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h index 7885d180e1..6262833dcb 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx index a26b6ae615..8a29665eea 100644 --- a/Source/cmInstallProgramsCommand.cxx +++ b/Source/cmInstallProgramsCommand.cxx @@ -18,7 +18,7 @@ // cmExecutableCommand bool cmInstallProgramsCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2) { diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h index 81800efa43..04fbb07f10 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmInstallTargetsCommand.cxx b/Source/cmInstallTargetsCommand.cxx index 246b118af7..d3ecddf7e0 100644 --- a/Source/cmInstallTargetsCommand.cxx +++ b/Source/cmInstallTargetsCommand.cxx @@ -18,7 +18,7 @@ // cmExecutableCommand bool cmInstallTargetsCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmInstallTargetsCommand.h b/Source/cmInstallTargetsCommand.h index e98b831b98..c6c8657f9e 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmLinkDirectoriesCommand.cxx b/Source/cmLinkDirectoriesCommand.cxx index 5eeb5bb30c..81b89452b7 100644 --- a/Source/cmLinkDirectoriesCommand.cxx +++ b/Source/cmLinkDirectoriesCommand.cxx @@ -18,7 +18,7 @@ // cmLinkDirectoriesCommand bool cmLinkDirectoriesCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmLinkDirectoriesCommand.h b/Source/cmLinkDirectoriesCommand.h index fe08656e8b..7f37ebfb7a 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx index 94f00512ed..b9e7a8fc18 100644 --- a/Source/cmLinkLibrariesCommand.cxx +++ b/Source/cmLinkLibrariesCommand.cxx @@ -17,7 +17,8 @@ #include "cmLinkLibrariesCommand.h" // cmLinkLibrariesCommand -bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args) +bool cmLinkLibrariesCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmLinkLibrariesCommand.h b/Source/cmLinkLibrariesCommand.h index a7e99629b1..0953bdbe16 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index b7519ab61f..f990ad5920 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -21,7 +21,8 @@ #include <stdlib.h> // required for atoi #include <ctype.h> //---------------------------------------------------------------------------- -bool cmListCommand::InitialPass(std::vector<std::string> const& args) +bool cmListCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmListCommand.h b/Source/cmListCommand.h index b5193b595d..d607b42533 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx index 062a7a66ce..0a8d3e6bca 100644 --- a/Source/cmLoadCacheCommand.cxx +++ b/Source/cmLoadCacheCommand.cxx @@ -19,7 +19,8 @@ #include <cmsys/RegularExpression.hxx> // cmLoadCacheCommand -bool cmLoadCacheCommand::InitialPass(std::vector<std::string> const& args) +bool cmLoadCacheCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if (args.size()< 1) { diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h index e19c35b3d4..4574a904d6 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index fe73ee8536..fe67443425 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> 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<std::string> const& args) +bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &) { if (!info.InitialPass) { @@ -222,7 +224,8 @@ cmLoadedCommand::~cmLoadedCommand() } // cmLoadCommandCommand -bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args) +bool cmLoadCommandCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmLoadCommandCommand.h b/Source/cmLoadCommandCommand.h index e63b9f1ab0..c654c6d7f0 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx index f5c418771a..6b927631d6 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<cmListFileArgument>& args); + virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args, + cmExecutionStatus &); - virtual bool InitialPass(std::vector<std::string> const&) { return false; }; + virtual bool InitialPass(std::vector<std::string> const&, + cmExecutionStatus &) { return false; }; /** * The name of the command as specified in CMakeList.txt. @@ -83,7 +85,8 @@ public: bool cmMacroHelperCommand::InvokeInitialPass -(const std::vector<cmListFileArgument>& args) +(const std::vector<cmListFileArgument>& args, + cmExecutionStatus &inStatus) { // Expand the argument list to the macro. std::vector<std::string> 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<std::string> const& args) +bool cmMacroCommand::InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmMacroCommand.h b/Source/cmMacroCommand.h index 01396c3193..4fcd597a7e 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmMakeDirectoryCommand.cxx b/Source/cmMakeDirectoryCommand.cxx index 3696296a87..6b1459eaa3 100644 --- a/Source/cmMakeDirectoryCommand.cxx +++ b/Source/cmMakeDirectoryCommand.cxx @@ -17,7 +17,8 @@ #include "cmMakeDirectoryCommand.h" // cmMakeDirectoryCommand -bool cmMakeDirectoryCommand::InitialPass(std::vector<std::string> const& args) +bool cmMakeDirectoryCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() != 1 ) { diff --git a/Source/cmMakeDirectoryCommand.h b/Source/cmMakeDirectoryCommand.h index db6b113114..77f230f286 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 6e99c17094..151ad5e77a 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 201a507b51..6bc80670d8 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<DefinitionMap> DefinitionStack; std::vector<cmCommand*> 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 93a843707b..841b34c1bc 100644 --- a/Source/cmMarkAsAdvancedCommand.cxx +++ b/Source/cmMarkAsAdvancedCommand.cxx @@ -18,7 +18,7 @@ // cmMarkAsAdvancedCommand bool cmMarkAsAdvancedCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index 73882850e4..62923c71a9 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index 6c8f7a2486..c7dde3a74e 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -19,7 +19,8 @@ #include "cmExprParserHelper.h" //---------------------------------------------------------------------------- -bool cmMathCommand::InitialPass(std::vector<std::string> const& args) +bool cmMathCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if ( args.size() < 1 ) { diff --git a/Source/cmMathCommand.h b/Source/cmMathCommand.h index 9f0d23ce88..08504d8f1b 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index f77cfd58c4..26d9012b89 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -17,7 +17,8 @@ #include "cmMessageCommand.h" // cmLibraryCommand -bool cmMessageCommand::InitialPass(std::vector<std::string> const& args) +bool cmMessageCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmMessageCommand.h b/Source/cmMessageCommand.h index 02c5c23e97..54cccd4369 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmOptionCommand.cxx b/Source/cmOptionCommand.cxx index 46bf045a07..0c704118a4 100644 --- a/Source/cmOptionCommand.cxx +++ b/Source/cmOptionCommand.cxx @@ -17,7 +17,8 @@ #include "cmOptionCommand.h" // cmOptionCommand -bool cmOptionCommand::InitialPass(std::vector<std::string> const& args) +bool cmOptionCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { bool argError = false; if(args.size() < 2) diff --git a/Source/cmOptionCommand.h b/Source/cmOptionCommand.h index c93c39eb40..b9fa01ef9c 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmOutputRequiredFilesCommand.cxx b/Source/cmOutputRequiredFilesCommand.cxx index e15fea2df4..98dfabce66 100644 --- a/Source/cmOutputRequiredFilesCommand.cxx +++ b/Source/cmOutputRequiredFilesCommand.cxx @@ -177,7 +177,7 @@ void cmLBDepend::DependWalk(cmDependInformation* info) // cmOutputRequiredFilesCommand bool cmOutputRequiredFilesCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> 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<cmDependInformation const*> 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<cmDependInformation const*> visited; - this->ListDependencies(info,fout, &visited); - fclose(fout); - } -} diff --git a/Source/cmOutputRequiredFilesCommand.h b/Source/cmOutputRequiredFilesCommand.h index da18446496..4241b2ecc2 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<std::string> const& args); - - virtual void FinalPass(); + virtual bool InitialPass(std::vector<std::string> 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 31d878a780..1823b5f1eb 100644 --- a/Source/cmProjectCommand.cxx +++ b/Source/cmProjectCommand.cxx @@ -17,7 +17,8 @@ #include "cmProjectCommand.h" // cmProjectCommand -bool cmProjectCommand::InitialPass(std::vector<std::string> const& args) +bool cmProjectCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h index 11e297ed85..4e9b2892ee 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmQTWrapCPPCommand.cxx b/Source/cmQTWrapCPPCommand.cxx index 6348d92d4f..991f29ac5b 100644 --- a/Source/cmQTWrapCPPCommand.cxx +++ b/Source/cmQTWrapCPPCommand.cxx @@ -17,7 +17,8 @@ #include "cmQTWrapCPPCommand.h" // cmQTWrapCPPCommand -bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn) +bool cmQTWrapCPPCommand::InitialPass(std::vector<std::string> const& argsIn, + cmExecutionStatus &) { if(argsIn.size() < 3 ) { diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index 98aeec0ff5..814aab9244 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmQTWrapUICommand.cxx b/Source/cmQTWrapUICommand.cxx index ff86ed9374..b8da0ff3cb 100644 --- a/Source/cmQTWrapUICommand.cxx +++ b/Source/cmQTWrapUICommand.cxx @@ -17,7 +17,8 @@ #include "cmQTWrapUICommand.h" // cmQTWrapUICommand -bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn) +bool cmQTWrapUICommand::InitialPass(std::vector<std::string> const& argsIn, + cmExecutionStatus &) { if(argsIn.size() < 4 ) { diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h index 491f175414..7f0101d988 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmRemoveCommand.cxx b/Source/cmRemoveCommand.cxx index 94388c0331..b44d299c30 100644 --- a/Source/cmRemoveCommand.cxx +++ b/Source/cmRemoveCommand.cxx @@ -17,7 +17,8 @@ #include "cmRemoveCommand.h" // cmRemoveCommand -bool cmRemoveCommand::InitialPass(std::vector<std::string> const& args) +bool cmRemoveCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmRemoveCommand.h b/Source/cmRemoveCommand.h index 10766a9bb0..6490e7c18f 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmRemoveDefinitionsCommand.cxx b/Source/cmRemoveDefinitionsCommand.cxx index 764117107d..f39dac0338 100644 --- a/Source/cmRemoveDefinitionsCommand.cxx +++ b/Source/cmRemoveDefinitionsCommand.cxx @@ -18,7 +18,7 @@ // cmRemoveDefinitionsCommand bool cmRemoveDefinitionsCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> 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 8ee5086dcc..52d50fb39d 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmReturnCommand.cxx b/Source/cmReturnCommand.cxx new file mode 100644 index 0000000000..b134d82257 --- /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<std::string> const&, + cmExecutionStatus &status) +{ + status.SetReturnInvoked(true); + return true; +} + diff --git a/Source/cmReturnCommand.h b/Source/cmReturnCommand.h new file mode 100644 index 0000000000..f10a5fdcbf --- /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<std::string> const& args, + cmExecutionStatus &status); + + /** + * This determines if the command is invoked when in script mode. + */ + virtual bool IsScriptable() { return true; } + + /** + * The name of the command as specified in CMakeList.txt. + */ + virtual const char* GetName() {return "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 5f3d88d985..6e015b7d2c 100644 --- a/Source/cmSeparateArgumentsCommand.cxx +++ b/Source/cmSeparateArgumentsCommand.cxx @@ -18,7 +18,7 @@ // cmSeparateArgumentsCommand bool cmSeparateArgumentsCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() != 1 ) { diff --git a/Source/cmSeparateArgumentsCommand.h b/Source/cmSeparateArgumentsCommand.h index 0bc87eff9d..827f7f2833 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 082dd4186f..512ae95333 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -17,7 +17,8 @@ #include "cmSetCommand.h" // cmSetCommand -bool cmSetCommand::InitialPass(std::vector<std::string> const& args) +bool cmSetCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 6f6ecd2bcd..e818d6a44d 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmSetDirectoryPropertiesCommand.cxx b/Source/cmSetDirectoryPropertiesCommand.cxx index 21333091af..2f34421b70 100644 --- a/Source/cmSetDirectoryPropertiesCommand.cxx +++ b/Source/cmSetDirectoryPropertiesCommand.cxx @@ -19,8 +19,8 @@ #include "cmake.h" // cmSetDirectoryPropertiesCommand -bool cmSetDirectoryPropertiesCommand::InitialPass( - std::vector<std::string> const& args) +bool cmSetDirectoryPropertiesCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmSetDirectoryPropertiesCommand.h b/Source/cmSetDirectoryPropertiesCommand.h index 039f21ae9d..aed9f673df 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx index 933a3e8cf6..0922c1dd2c 100644 --- a/Source/cmSetPropertyCommand.cxx +++ b/Source/cmSetPropertyCommand.cxx @@ -26,7 +26,8 @@ cmSetPropertyCommand::cmSetPropertyCommand() } //---------------------------------------------------------------------------- -bool cmSetPropertyCommand::InitialPass(std::vector<std::string> const& args) +bool cmSetPropertyCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmSetPropertyCommand.h b/Source/cmSetPropertyCommand.h index 06d4da59bf..a6d3966ca0 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmSetSourceFilesPropertiesCommand.cxx b/Source/cmSetSourceFilesPropertiesCommand.cxx index 5e7618d435..9c6153b16f 100644 --- a/Source/cmSetSourceFilesPropertiesCommand.cxx +++ b/Source/cmSetSourceFilesPropertiesCommand.cxx @@ -19,8 +19,8 @@ #include "cmSourceFile.h" // cmSetSourceFilesPropertiesCommand -bool cmSetSourceFilesPropertiesCommand::InitialPass( - std::vector<std::string> const& args) +bool cmSetSourceFilesPropertiesCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmSetSourceFilesPropertiesCommand.h b/Source/cmSetSourceFilesPropertiesCommand.h index fad76eefb3..e210de2627 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index 4fb2fb94d4..ccbe0d5fa6 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -19,8 +19,8 @@ #include "cmGlobalGenerator.h" // cmSetTargetPropertiesCommand -bool cmSetTargetPropertiesCommand::InitialPass( - std::vector<std::string> const& args) +bool cmSetTargetPropertiesCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index bc48a70491..e9ff1ce952 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmSetTestsPropertiesCommand.cxx b/Source/cmSetTestsPropertiesCommand.cxx index 0d4c3fc798..8a849b3053 100644 --- a/Source/cmSetTestsPropertiesCommand.cxx +++ b/Source/cmSetTestsPropertiesCommand.cxx @@ -20,8 +20,8 @@ #include "cmTest.h" // cmSetTestsPropertiesCommand -bool cmSetTestsPropertiesCommand::InitialPass( - std::vector<std::string> const& args) +bool cmSetTestsPropertiesCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index 8717d903a6..e25b0a5f0f 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmSiteNameCommand.cxx b/Source/cmSiteNameCommand.cxx index 7e2e87e82e..ef29638c85 100644 --- a/Source/cmSiteNameCommand.cxx +++ b/Source/cmSiteNameCommand.cxx @@ -19,7 +19,8 @@ #include <cmsys/RegularExpression.hxx> // cmSiteNameCommand -bool cmSiteNameCommand::InitialPass(std::vector<std::string> const& args) +bool cmSiteNameCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() != 1 ) { diff --git a/Source/cmSiteNameCommand.h b/Source/cmSiteNameCommand.h index 7c03268477..6d46eecd84 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index 97385c9aca..b21cada4df 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -48,7 +48,8 @@ inline std::vector<std::string> tokenize(const std::string& str, } // cmSourceGroupCommand -bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args) +bool cmSourceGroupCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmSourceGroupCommand.h b/Source/cmSourceGroupCommand.h index 5d56bf7b72..c4edf87d3a 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 7ef39af94d..df32afc077 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -23,7 +23,8 @@ #include <time.h> //---------------------------------------------------------------------------- -bool cmStringCommand::InitialPass(std::vector<std::string> const& args) +bool cmStringCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index f0b7c9e431..3fa8a83822 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmSubdirCommand.cxx b/Source/cmSubdirCommand.cxx index 48b558dec9..f932ebcf7f 100644 --- a/Source/cmSubdirCommand.cxx +++ b/Source/cmSubdirCommand.cxx @@ -17,7 +17,8 @@ #include "cmSubdirCommand.h" // cmSubdirCommand -bool cmSubdirCommand::InitialPass(std::vector<std::string> const& args) +bool cmSubdirCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 1 ) { diff --git a/Source/cmSubdirCommand.h b/Source/cmSubdirCommand.h index bf21ab5762..1e79bd8ae8 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmSubdirDependsCommand.cxx b/Source/cmSubdirDependsCommand.cxx index bcb3d9b6f2..c3250e42b1 100644 --- a/Source/cmSubdirDependsCommand.cxx +++ b/Source/cmSubdirDependsCommand.cxx @@ -17,7 +17,8 @@ #include "cmSubdirDependsCommand.h" // cmSubdirDependsCommand -bool cmSubdirDependsCommand::InitialPass(std::vector<std::string> const& ) +bool cmSubdirDependsCommand::InitialPass(std::vector<std::string> const& , + cmExecutionStatus &) { return true; } diff --git a/Source/cmSubdirDependsCommand.h b/Source/cmSubdirDependsCommand.h index 4a1ca225fd..0e7bbc6103 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx index 2b649b1e2c..8c06e071e1 100644 --- a/Source/cmTargetLinkLibrariesCommand.cxx +++ b/Source/cmTargetLinkLibrariesCommand.cxx @@ -17,8 +17,8 @@ #include "cmTargetLinkLibrariesCommand.h" // cmTargetLinkLibrariesCommand -bool cmTargetLinkLibrariesCommand::InitialPass(std::vector<std::string> - const& args) +bool cmTargetLinkLibrariesCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { // must have one argument if(args.size() < 1) diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h index d84faa62a2..1e2cac181b 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx index a48f7232a1..b286e766ab 100644 --- a/Source/cmTryCompileCommand.cxx +++ b/Source/cmTryCompileCommand.cxx @@ -17,7 +17,8 @@ #include "cmTryCompileCommand.h" // cmTryCompileCommand -bool cmTryCompileCommand::InitialPass(std::vector<std::string> const& argv) +bool cmTryCompileCommand +::InitialPass(std::vector<std::string> const& argv, cmExecutionStatus &) { if(argv.size() < 3) { diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h index 27a65abb5e..2a45b495f3 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index e6b872dd05..e7dff781fd 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -19,14 +19,15 @@ #include "cmTryCompileCommand.h" // cmTryRunCommand -bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv) +bool cmTryRunCommand +::InitialPass(std::vector<std::string> 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<std::string> tryCompile; this->CompileResultVariable = ""; diff --git a/Source/cmTryRunCommand.h b/Source/cmTryRunCommand.h index 0a8648697f..a839fe4e67 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmUseMangledMesaCommand.cxx b/Source/cmUseMangledMesaCommand.cxx index 0e73cefc8e..63ca142ea7 100644 --- a/Source/cmUseMangledMesaCommand.cxx +++ b/Source/cmUseMangledMesaCommand.cxx @@ -21,7 +21,7 @@ // cmUseMangledMesaCommand bool cmUseMangledMesaCommand -::InitialPass(std::vector<std::string> const& args) +::InitialPass(std::vector<std::string> 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 8c38ab66d0..971d92678e 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmUtilitySourceCommand.cxx b/Source/cmUtilitySourceCommand.cxx index 8485bfd1d9..f8683cee3e 100644 --- a/Source/cmUtilitySourceCommand.cxx +++ b/Source/cmUtilitySourceCommand.cxx @@ -17,7 +17,8 @@ #include "cmUtilitySourceCommand.h" // cmUtilitySourceCommand -bool cmUtilitySourceCommand::InitialPass(std::vector<std::string> const& args) +bool cmUtilitySourceCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 3) { diff --git a/Source/cmUtilitySourceCommand.h b/Source/cmUtilitySourceCommand.h index 4fd0474edc..921c45584c 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmVariableRequiresCommand.cxx b/Source/cmVariableRequiresCommand.cxx index b119c94bd4..69b50dbb69 100644 --- a/Source/cmVariableRequiresCommand.cxx +++ b/Source/cmVariableRequiresCommand.cxx @@ -18,8 +18,8 @@ #include "cmCacheManager.h" // cmLibraryCommand -bool cmVariableRequiresCommand::InitialPass(std::vector<std::string>const& - args) +bool cmVariableRequiresCommand +::InitialPass(std::vector<std::string>const& args, cmExecutionStatus &) { if(args.size() < 3 ) { diff --git a/Source/cmVariableRequiresCommand.h b/Source/cmVariableRequiresCommand.h index 75e6367a18..f953bdc557 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * The name of the command as specified in CMakeList.txt. diff --git a/Source/cmVariableWatchCommand.cxx b/Source/cmVariableWatchCommand.cxx index 8c5ed31060..a5ee70c916 100644 --- a/Source/cmVariableWatchCommand.cxx +++ b/Source/cmVariableWatchCommand.cxx @@ -35,7 +35,8 @@ cmVariableWatchCommand::cmVariableWatchCommand() } //---------------------------------------------------------------------------- -bool cmVariableWatchCommand::InitialPass(std::vector<std::string> const& args) +bool cmVariableWatchCommand +::InitialPass(std::vector<std::string> 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 db7a4d07e3..61d6226e8b 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmWhileCommand.cxx b/Source/cmWhileCommand.cxx index e4e17d9934..96842218bb 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<cmListFileArgument>& args) +bool cmWhileCommand +::InvokeInitialPass(const std::vector<cmListFileArgument>& args, + cmExecutionStatus &) { if(args.size() < 1) { diff --git a/Source/cmWhileCommand.h b/Source/cmWhileCommand.h index a934db4c15..c95df73fb2 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<cmListFileArgument>& args); + virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args, + cmExecutionStatus &); /** * This is called when the command is first encountered in * the CMakeLists.txt file. */ - virtual bool InitialPass(std::vector<std::string> const&) { return false; } + virtual bool InitialPass(std::vector<std::string> const&, + cmExecutionStatus &) { return false; } /** * This determines if the command is invoked when in script mode. diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index 08d02b8e67..8afd7586a0 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -20,7 +20,8 @@ #include <sys/stat.h> // cmLibraryCommand -bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& args) +bool cmWriteFileCommand +::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &) { if(args.size() < 2 ) { diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h index 643f9496d6..0c69dd810a 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<std::string> const& args); + virtual bool InitialPass(std::vector<std::string> const& args, + cmExecutionStatus &status); /** * This determines if the command is invoked when in script mode. |