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

This commit is contained in:
Ken Martin 2008-01-23 10:28:26 -05:00
parent 72a301f880
commit 0e69d38004
205 changed files with 907 additions and 360 deletions

View File

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

View File

@ -47,7 +47,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -35,7 +35,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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); cmTypeMacro(cmCTestHandlerCommand, cmCTestCommand);

View File

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

View File

@ -45,7 +45,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -46,7 +46,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

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

View File

@ -46,7 +46,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -45,7 +45,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

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

View File

@ -42,7 +42,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -41,7 +41,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -40,7 +40,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -39,7 +39,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -40,7 +40,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -40,7 +40,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -41,7 +41,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

@ -20,7 +20,8 @@
// cmExecutableCommand // 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 // 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 // the executable to run (a target or external program) Remaining arguments

View File

@ -39,7 +39,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -43,7 +43,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

26
Source/cmBreakCommand.cxx Normal file
View File

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

78
Source/cmBreakCommand.h Normal file
View File

@ -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

View File

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

View File

@ -39,7 +39,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -39,7 +39,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

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

View File

@ -39,7 +39,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

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

View File

@ -60,18 +60,20 @@ public:
* encountered in the CMakeLists.txt file. It expands the command's * encountered in the CMakeLists.txt file. It expands the command's
* arguments and then invokes the InitialPass. * 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; std::vector<std::string> expandedArguments;
this->Makefile->ExpandArguments(args, 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 * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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 * This is called at the end after all the information

View File

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

View File

@ -33,7 +33,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the input file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -39,7 +39,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -31,7 +31,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the input file. * 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. * The name of the command as specified in CMakeList.txt.

View File

@ -16,7 +16,8 @@
=========================================================================*/ =========================================================================*/
#include "cmElseCommand.h" #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 " this->SetError("An ELSE command was found outside of a proper "
"IF ENDIF structure. Or its arguments did not match " "IF ENDIF structure. Or its arguments did not match "

View File

@ -39,7 +39,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

@ -16,7 +16,8 @@
=========================================================================*/ =========================================================================*/
#include "cmElseIfCommand.h" #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 " this->SetError("An ELSEIF command was found outside of a proper "
"IF ENDIF structure."); "IF ENDIF structure.");

View File

@ -39,7 +39,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

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

View File

@ -42,7 +42,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

@ -19,7 +19,8 @@
// we do this in the final pass so that we now the subdirs have all // we do this in the final pass so that we now the subdirs have all
// been defined // 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"); this->Makefile->AddDefinition("CMAKE_TESTING_ENABLED","1");
return true; return true;

View File

@ -47,7 +47,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -39,13 +39,15 @@ public:
* Override cmCommand::InvokeInitialPass to get arguments before * Override cmCommand::InvokeInitialPass to get arguments before
* expansion. * 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 * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

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

View File

@ -39,13 +39,15 @@ public:
* Override cmCommand::InvokeInitialPass to get arguments before * Override cmCommand::InvokeInitialPass to get arguments before
* expansion. * 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 * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

@ -16,7 +16,8 @@
=========================================================================*/ =========================================================================*/
#include "cmEndIfCommand.h" #include "cmEndIfCommand.h"
#include <stdlib.h> // required for atof #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 const char* versionValue
= this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION"); = this->Makefile->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION");

View File

@ -39,7 +39,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

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

View File

@ -39,13 +39,15 @@ public:
* Override cmCommand::InvokeInitialPass to get arguments before * Override cmCommand::InvokeInitialPass to get arguments before
* expansion. * 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 * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

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

View File

@ -39,13 +39,15 @@ public:
* Override cmCommand::InvokeInitialPass to get arguments before * Override cmCommand::InvokeInitialPass to get arguments before
* expansion. * 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 * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

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

View File

@ -41,7 +41,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -40,7 +40,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

@ -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

View File

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

View File

@ -41,7 +41,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * The name of the command as specified in CMakeList.txt.

View File

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

View File

@ -40,7 +40,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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 * This is called at the end after all the information

View File

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

View File

@ -42,7 +42,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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 * This is called at the end after all the information

View File

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

View File

@ -40,7 +40,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

@ -55,7 +55,8 @@ cmFindLibraryCommand::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->VariableDocumentation = "Path to a library.";
this->CMakePathName = "LIBRARY"; this->CMakePathName = "LIBRARY";

View File

@ -43,7 +43,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

@ -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) if(args.size() < 1)
{ {

View File

@ -43,7 +43,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

@ -70,7 +70,8 @@ const char* cmFindPathCommand::GetFullDocumentation()
} }
// cmFindPathCommand // 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->VariableDocumentation = "Path to a file.";
this->CMakePathName = "INCLUDE"; this->CMakePathName = "INCLUDE";

View File

@ -43,7 +43,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

@ -51,7 +51,8 @@ cmFindProgramCommand::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->VariableDocumentation = "Path to a program.";
this->CMakePathName = "PROGRAM"; this->CMakePathName = "PROGRAM";

View File

@ -43,7 +43,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

@ -17,9 +17,10 @@
#include "cmForEachCommand.h" #include "cmForEachCommand.h"
bool cmForEachFunctionBlocker:: 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. // commands.
if (this->Executing) if (this->Executing)
{ {
@ -54,9 +55,26 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf)
// set the variable to the loop value // set the variable to the loop value
mf.AddDefinition(this->Args[0].c_str(),j->c_str()); mf.AddDefinition(this->Args[0].c_str(),j->c_str());
// Invoke all the functions that were collected in the block. // Invoke all the functions that were collected in the block.
cmExecutionStatus status;
for(unsigned int c = 0; c < this->Functions.size(); ++c) 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 // restore the variable to its prior value
@ -105,7 +123,8 @@ ScopeEnded(cmMakefile &mf)
mf.GetCurrentDirectory()); 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) if(args.size() < 1)
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,7 +31,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the input file. * 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. * This determines if the command is invoked when in script mode.

View File

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

View File

@ -31,7 +31,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the input file. * 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. * This determines if the command is invoked when in script mode.

View File

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

View File

@ -40,7 +40,8 @@ public:
* This is called when the command is first encountered in * This is called when the command is first encountered in
* the CMakeLists.txt file. * 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. * This determines if the command is invoked when in script mode.

View File

@ -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 ) if(args.size() < 3 )
{ {

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