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"
bool cmCTestEmptyBinaryDirectoryCommand::InitialPass(
std::vector<std::string> const& args)
bool cmCTestEmptyBinaryDirectoryCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
if(args.size() != 1 )
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 )
{
@ -269,7 +274,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.
@ -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);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

26
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"
// cmBuildCommand
bool cmBuildCommand::InitialPass(std::vector<std::string> const& args)
bool cmBuildCommand
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
if(args.size() < 2 )
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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.");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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
bool cmExportCommand
::InitialPass(std::vector<std::string> const& args)
::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
{
if(args.size() < 2 )
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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)
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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 )
{

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