mirror of
https://github.com/reactos/CMake.git
synced 2024-12-18 00:57:37 +00:00
cmState: introduce method for adding scripted commands
This commit is contained in:
parent
c734c8501b
commit
a44dab461f
@ -149,11 +149,7 @@ bool cmFunctionFunctionBlocker::IsFunctionBlocked(
|
||||
f->Functions = this->Functions;
|
||||
f->FilePath = this->GetStartingContext().FilePath;
|
||||
mf.RecordPolicies(f->Policies);
|
||||
|
||||
std::string newName = "_" + this->Args[0];
|
||||
mf.GetState()->RenameCommand(this->Args[0], newName);
|
||||
mf.GetState()->AddCommand(f);
|
||||
|
||||
mf.GetState()->AddScriptedCommand(this->Args[0], f);
|
||||
// remove the function blocker now that the function is defined
|
||||
mf.RemoveFunctionBlocker(this, lff);
|
||||
return true;
|
||||
|
@ -246,7 +246,7 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args,
|
||||
// create a function blocker and set it up
|
||||
cmLoadedCommand* f = new cmLoadedCommand();
|
||||
(*initFunction)(&f->info);
|
||||
this->Makefile->GetState()->AddCommand(f);
|
||||
this->Makefile->GetState()->AddScriptedCommand(args[0], f);
|
||||
return true;
|
||||
}
|
||||
this->SetError("Attempt to load command failed. "
|
||||
|
@ -184,10 +184,7 @@ bool cmMacroFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
|
||||
f->Functions = this->Functions;
|
||||
f->FilePath = this->GetStartingContext().FilePath;
|
||||
mf.RecordPolicies(f->Policies);
|
||||
std::string newName = "_" + this->Args[0];
|
||||
mf.GetState()->RenameCommand(this->Args[0], newName);
|
||||
mf.GetState()->AddCommand(f);
|
||||
|
||||
mf.GetState()->AddScriptedCommand(this->Args[0], f);
|
||||
// remove the function blocker now that the macro is defined
|
||||
mf.RemoveFunctionBlocker(this, lff);
|
||||
return true;
|
||||
|
@ -433,6 +433,12 @@ void cmState::AddUnexpectedCommand(std::string const& name, const char* error)
|
||||
this->AddBuiltinCommand(name, new cmUnexpectedCommand(name, error));
|
||||
}
|
||||
|
||||
void cmState::AddScriptedCommand(std::string const& name, cmCommand* command)
|
||||
{
|
||||
this->RenameCommand(name, "_" + name);
|
||||
this->AddCommand(command);
|
||||
}
|
||||
|
||||
cmCommand* cmState::GetCommand(std::string const& name) const
|
||||
{
|
||||
cmCommand* command = CM_NULLPTR;
|
||||
|
@ -126,6 +126,7 @@ public:
|
||||
void AddDisallowedCommand(std::string const& name, cmCommand* command,
|
||||
cmPolicies::PolicyID policy, const char* message);
|
||||
void AddUnexpectedCommand(std::string const& name, const char* error);
|
||||
void AddScriptedCommand(std::string const& name, cmCommand* command);
|
||||
void RenameCommand(std::string const& oldName, std::string const& newName);
|
||||
void RemoveUserDefinedCommands();
|
||||
std::vector<std::string> GetCommandNames() const;
|
||||
|
Loading…
Reference in New Issue
Block a user