Port cmCommand consumers to cmState.
This commit is contained in:
parent
96f8c5f9a3
commit
0aec491328
|
@ -198,7 +198,7 @@ int main (int argc, char const* const* argv)
|
||||||
"Read CPack config file: " << cpackConfigFile << std::endl);
|
"Read CPack config file: " << cpackConfigFile << std::endl);
|
||||||
|
|
||||||
cmake cminst;
|
cmake cminst;
|
||||||
cminst.RemoveUnscriptableCommands();
|
cminst.GetState()->RemoveUnscriptableCommands();
|
||||||
cmGlobalGenerator cmgg;
|
cmGlobalGenerator cmgg;
|
||||||
cmgg.SetCMakeInstance(&cminst);
|
cmgg.SetCMakeInstance(&cminst);
|
||||||
cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator());
|
cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator());
|
||||||
|
|
|
@ -214,7 +214,7 @@ void cmCTestScriptHandler::AddCTestCommand(cmCTestCommand* command)
|
||||||
cmCTestCommand* newCom = command;
|
cmCTestCommand* newCom = command;
|
||||||
newCom->CTest = this->CTest;
|
newCom->CTest = this->CTest;
|
||||||
newCom->CTestScriptHandler = this;
|
newCom->CTestScriptHandler = this;
|
||||||
this->CMake->AddCommand(newCom);
|
this->CMake->GetState()->AddCommand(newCom);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
|
int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
|
||||||
|
@ -353,7 +353,7 @@ void cmCTestScriptHandler::CreateCMake()
|
||||||
|
|
||||||
// remove all cmake commands which are not scriptable, since they can't be
|
// remove all cmake commands which are not scriptable, since they can't be
|
||||||
// used in ctest scripts
|
// used in ctest scripts
|
||||||
this->CMake->RemoveUnscriptableCommands();
|
this->CMake->GetState()->RemoveUnscriptableCommands();
|
||||||
|
|
||||||
// add any ctest specific commands, probably should have common superclass
|
// add any ctest specific commands, probably should have common superclass
|
||||||
// for ctest commands to clean this up. If a couple more commands are
|
// for ctest commands to clean this up. If a couple more commands are
|
||||||
|
|
|
@ -1585,25 +1585,25 @@ void cmCTestTestHandler::GetListOfTests()
|
||||||
// Add handler for ADD_TEST
|
// Add handler for ADD_TEST
|
||||||
cmCTestAddTestCommand* newCom1 = new cmCTestAddTestCommand;
|
cmCTestAddTestCommand* newCom1 = new cmCTestAddTestCommand;
|
||||||
newCom1->TestHandler = this;
|
newCom1->TestHandler = this;
|
||||||
cm.AddCommand(newCom1);
|
cm.GetState()->AddCommand(newCom1);
|
||||||
|
|
||||||
// Add handler for SUBDIRS
|
// Add handler for SUBDIRS
|
||||||
cmCTestSubdirCommand* newCom2 =
|
cmCTestSubdirCommand* newCom2 =
|
||||||
new cmCTestSubdirCommand;
|
new cmCTestSubdirCommand;
|
||||||
newCom2->TestHandler = this;
|
newCom2->TestHandler = this;
|
||||||
cm.AddCommand(newCom2);
|
cm.GetState()->AddCommand(newCom2);
|
||||||
|
|
||||||
// Add handler for ADD_SUBDIRECTORY
|
// Add handler for ADD_SUBDIRECTORY
|
||||||
cmCTestAddSubdirectoryCommand* newCom3 =
|
cmCTestAddSubdirectoryCommand* newCom3 =
|
||||||
new cmCTestAddSubdirectoryCommand;
|
new cmCTestAddSubdirectoryCommand;
|
||||||
newCom3->TestHandler = this;
|
newCom3->TestHandler = this;
|
||||||
cm.AddCommand(newCom3);
|
cm.GetState()->AddCommand(newCom3);
|
||||||
|
|
||||||
// Add handler for SET_SOURCE_FILES_PROPERTIES
|
// Add handler for SET_SOURCE_FILES_PROPERTIES
|
||||||
cmCTestSetTestsPropertiesCommand* newCom4
|
cmCTestSetTestsPropertiesCommand* newCom4
|
||||||
= new cmCTestSetTestsPropertiesCommand;
|
= new cmCTestSetTestsPropertiesCommand;
|
||||||
newCom4->TestHandler = this;
|
newCom4->TestHandler = this;
|
||||||
cm.AddCommand(newCom4);
|
cm.GetState()->AddCommand(newCom4);
|
||||||
|
|
||||||
const char* testFilename;
|
const char* testFilename;
|
||||||
if( cmSystemTools::FileExists("CTestTestfile.cmake") )
|
if( cmSystemTools::FileExists("CTestTestfile.cmake") )
|
||||||
|
|
|
@ -164,7 +164,7 @@ int CCONV cmIsOn(void *arg, const char* name)
|
||||||
int CCONV cmCommandExists(void *arg, const char* name)
|
int CCONV cmCommandExists(void *arg, const char* name)
|
||||||
{
|
{
|
||||||
cmMakefile *mf = static_cast<cmMakefile *>(arg);
|
cmMakefile *mf = static_cast<cmMakefile *>(arg);
|
||||||
return static_cast<int>(mf->CommandExists(name));
|
return static_cast<int>(mf->GetState()->GetCommand(name) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCONV cmAddDefineFlag(void *arg, const char* definition)
|
void CCONV cmAddDefineFlag(void *arg, const char* definition)
|
||||||
|
|
|
@ -481,8 +481,10 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs,
|
||||||
// does a command exist
|
// does a command exist
|
||||||
if (this->IsKeyword("COMMAND", *arg) && argP1 != newArgs.end())
|
if (this->IsKeyword("COMMAND", *arg) && argP1 != newArgs.end())
|
||||||
{
|
{
|
||||||
|
cmCommand* command =
|
||||||
|
this->Makefile.GetState()->GetCommand(argP1->c_str());
|
||||||
this->HandlePredicate(
|
this->HandlePredicate(
|
||||||
this->Makefile.CommandExists(argP1->c_str()),
|
command ? true : false,
|
||||||
reducible, arg, newArgs, argP1, argP2);
|
reducible, arg, newArgs, argP1, argP2);
|
||||||
}
|
}
|
||||||
// does a policy exist
|
// does a policy exist
|
||||||
|
|
|
@ -193,9 +193,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string newName = "_" + this->Args[0];
|
std::string newName = "_" + this->Args[0];
|
||||||
mf.GetCMakeInstance()->RenameCommand(this->Args[0],
|
mf.GetState()->RenameCommand(this->Args[0], newName);
|
||||||
newName);
|
mf.GetState()->AddCommand(f);
|
||||||
mf.AddCommand(f);
|
|
||||||
|
|
||||||
// remove the function blocker now that the function is defined
|
// remove the function blocker now that the function is defined
|
||||||
mf.RemoveFunctionBlocker(this, lff);
|
mf.RemoveFunctionBlocker(this, lff);
|
||||||
|
|
|
@ -273,7 +273,7 @@ bool cmLoadCommandCommand
|
||||||
// create a function blocker and set it up
|
// create a function blocker and set it up
|
||||||
cmLoadedCommand *f = new cmLoadedCommand();
|
cmLoadedCommand *f = new cmLoadedCommand();
|
||||||
(*initFunction)(&f->info);
|
(*initFunction)(&f->info);
|
||||||
this->Makefile->AddCommand(f);
|
this->Makefile->GetState()->AddCommand(f);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
this->SetError("Attempt to load command failed. "
|
this->SetError("Attempt to load command failed. "
|
||||||
|
|
|
@ -232,9 +232,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
|
||||||
f->Functions = this->Functions;
|
f->Functions = this->Functions;
|
||||||
mf.RecordPolicies(f->Policies);
|
mf.RecordPolicies(f->Policies);
|
||||||
std::string newName = "_" + this->Args[0];
|
std::string newName = "_" + this->Args[0];
|
||||||
mf.GetCMakeInstance()->RenameCommand(this->Args[0],
|
mf.GetState()->RenameCommand(this->Args[0], newName);
|
||||||
newName);
|
mf.GetState()->AddCommand(f);
|
||||||
mf.AddCommand(f);
|
|
||||||
|
|
||||||
// remove the function blocker now that the macro is defined
|
// remove the function blocker now that the macro is defined
|
||||||
mf.RemoveFunctionBlocker(this, lff);
|
mf.RemoveFunctionBlocker(this, lff);
|
||||||
|
|
|
@ -244,12 +244,6 @@ void cmMakefile::Print() const
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmMakefile::CommandExists(const char* name) const
|
|
||||||
{
|
|
||||||
return this->GetCMakeInstance()->CommandExists(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmMakefile::IssueMessage(cmake::MessageType t,
|
void cmMakefile::IssueMessage(cmake::MessageType t,
|
||||||
std::string const& text) const
|
std::string const& text) const
|
||||||
|
@ -340,7 +334,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
|
||||||
static_cast<void>(stack_manager);
|
static_cast<void>(stack_manager);
|
||||||
|
|
||||||
// Lookup the command prototype.
|
// Lookup the command prototype.
|
||||||
if(cmCommand* proto = this->GetCMakeInstance()->GetCommand(name))
|
if(cmCommand* proto = this->GetState()->GetCommand(name))
|
||||||
{
|
{
|
||||||
// Clone the prototype.
|
// Clone the prototype.
|
||||||
cmsys::auto_ptr<cmCommand> pcmd(proto->Clone());
|
cmsys::auto_ptr<cmCommand> pcmd(proto->Clone());
|
||||||
|
@ -718,11 +712,6 @@ void cmMakefile::EnforceDirectoryLevelRules() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmMakefile::AddCommand(cmCommand* wg)
|
|
||||||
{
|
|
||||||
this->GetCMakeInstance()->AddCommand(wg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the make file
|
// Set the make file
|
||||||
void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
|
void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -746,14 +746,6 @@ public:
|
||||||
bool ExecuteCommand(const cmListFileFunction& lff,
|
bool ExecuteCommand(const cmListFileFunction& lff,
|
||||||
cmExecutionStatus &status);
|
cmExecutionStatus &status);
|
||||||
|
|
||||||
/** Check if a command exists. */
|
|
||||||
bool CommandExists(const char* name) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a command to this cmake instance
|
|
||||||
*/
|
|
||||||
void AddCommand(cmCommand* );
|
|
||||||
|
|
||||||
///! Enable support for named language, if nil then all languages are
|
///! Enable support for named language, if nil then all languages are
|
||||||
///enabled.
|
///enabled.
|
||||||
void EnableLanguage(std::vector<std::string>const& languages, bool optional);
|
void EnableLanguage(std::vector<std::string>const& languages, bool optional);
|
||||||
|
|
|
@ -1758,7 +1758,7 @@ void cmake::AddDefaultCommands()
|
||||||
for(std::vector<cmCommand*>::iterator i = commands.begin();
|
for(std::vector<cmCommand*>::iterator i = commands.begin();
|
||||||
i != commands.end(); ++i)
|
i != commands.end(); ++i)
|
||||||
{
|
{
|
||||||
this->AddCommand(*i);
|
this->State->AddCommand(*i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue