summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-04-11 10:52:14 (GMT)
committerBrad King <brad.king@kitware.com>2015-04-15 15:43:49 (GMT)
commit0aec49132885be07e1d92a4a1db58f4c6c4c2844 (patch)
treeba5db3057c7431795a8aa9762f0cfbc5f252e406 /Source
parent96f8c5f9a3bd60f553af054b43e06ce4864269e0 (diff)
downloadCMake-0aec49132885be07e1d92a4a1db58f4c6c4c2844.zip
CMake-0aec49132885be07e1d92a4a1db58f4c6c4c2844.tar.gz
CMake-0aec49132885be07e1d92a4a1db58f4c6c4c2844.tar.bz2
Port cmCommand consumers to cmState.
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/cpack.cxx2
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx4
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx8
-rw-r--r--Source/cmCPluginAPI.cxx2
-rw-r--r--Source/cmConditionEvaluator.cxx4
-rw-r--r--Source/cmFunctionCommand.cxx5
-rw-r--r--Source/cmLoadCommandCommand.cxx2
-rw-r--r--Source/cmMacroCommand.cxx5
-rw-r--r--Source/cmMakefile.cxx13
-rw-r--r--Source/cmMakefile.h8
-rw-r--r--Source/cmake.cxx2
11 files changed, 18 insertions, 37 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 00b23cd..a9cabf1 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -198,7 +198,7 @@ int main (int argc, char const* const* argv)
"Read CPack config file: " << cpackConfigFile << std::endl);
cmake cminst;
- cminst.RemoveUnscriptableCommands();
+ cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg;
cmgg.SetCMakeInstance(&cminst);
cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator());
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index 3792953..783941b 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -214,7 +214,7 @@ void cmCTestScriptHandler::AddCTestCommand(cmCTestCommand* command)
cmCTestCommand* newCom = command;
newCom->CTest = this->CTest;
newCom->CTestScriptHandler = this;
- this->CMake->AddCommand(newCom);
+ this->CMake->GetState()->AddCommand(newCom);
}
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
// used in ctest scripts
- this->CMake->RemoveUnscriptableCommands();
+ this->CMake->GetState()->RemoveUnscriptableCommands();
// add any ctest specific commands, probably should have common superclass
// for ctest commands to clean this up. If a couple more commands are
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 0e84fbf..c50ea88 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1585,25 +1585,25 @@ void cmCTestTestHandler::GetListOfTests()
// Add handler for ADD_TEST
cmCTestAddTestCommand* newCom1 = new cmCTestAddTestCommand;
newCom1->TestHandler = this;
- cm.AddCommand(newCom1);
+ cm.GetState()->AddCommand(newCom1);
// Add handler for SUBDIRS
cmCTestSubdirCommand* newCom2 =
new cmCTestSubdirCommand;
newCom2->TestHandler = this;
- cm.AddCommand(newCom2);
+ cm.GetState()->AddCommand(newCom2);
// Add handler for ADD_SUBDIRECTORY
cmCTestAddSubdirectoryCommand* newCom3 =
new cmCTestAddSubdirectoryCommand;
newCom3->TestHandler = this;
- cm.AddCommand(newCom3);
+ cm.GetState()->AddCommand(newCom3);
// Add handler for SET_SOURCE_FILES_PROPERTIES
cmCTestSetTestsPropertiesCommand* newCom4
= new cmCTestSetTestsPropertiesCommand;
newCom4->TestHandler = this;
- cm.AddCommand(newCom4);
+ cm.GetState()->AddCommand(newCom4);
const char* testFilename;
if( cmSystemTools::FileExists("CTestTestfile.cmake") )
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 6134c6f..77cd6c6 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -164,7 +164,7 @@ int CCONV cmIsOn(void *arg, const char* name)
int CCONV cmCommandExists(void *arg, const char* name)
{
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)
diff --git a/Source/cmConditionEvaluator.cxx b/Source/cmConditionEvaluator.cxx
index eb4f3a1..0a71c60 100644
--- a/Source/cmConditionEvaluator.cxx
+++ b/Source/cmConditionEvaluator.cxx
@@ -481,8 +481,10 @@ bool cmConditionEvaluator::HandleLevel1(cmArgumentList &newArgs,
// does a command exist
if (this->IsKeyword("COMMAND", *arg) && argP1 != newArgs.end())
{
+ cmCommand* command =
+ this->Makefile.GetState()->GetCommand(argP1->c_str());
this->HandlePredicate(
- this->Makefile.CommandExists(argP1->c_str()),
+ command ? true : false,
reducible, arg, newArgs, argP1, argP2);
}
// does a policy exist
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 9297688..fdd1018 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -193,9 +193,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
}
std::string newName = "_" + this->Args[0];
- mf.GetCMakeInstance()->RenameCommand(this->Args[0],
- newName);
- mf.AddCommand(f);
+ mf.GetState()->RenameCommand(this->Args[0], newName);
+ mf.GetState()->AddCommand(f);
// remove the function blocker now that the function is defined
mf.RemoveFunctionBlocker(this, lff);
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx
index cdfd00c..403f7fc 100644
--- a/Source/cmLoadCommandCommand.cxx
+++ b/Source/cmLoadCommandCommand.cxx
@@ -273,7 +273,7 @@ bool cmLoadCommandCommand
// create a function blocker and set it up
cmLoadedCommand *f = new cmLoadedCommand();
(*initFunction)(&f->info);
- this->Makefile->AddCommand(f);
+ this->Makefile->GetState()->AddCommand(f);
return true;
}
this->SetError("Attempt to load command failed. "
diff --git a/Source/cmMacroCommand.cxx b/Source/cmMacroCommand.cxx
index b7cbae6..7ac4432 100644
--- a/Source/cmMacroCommand.cxx
+++ b/Source/cmMacroCommand.cxx
@@ -232,9 +232,8 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf,
f->Functions = this->Functions;
mf.RecordPolicies(f->Policies);
std::string newName = "_" + this->Args[0];
- mf.GetCMakeInstance()->RenameCommand(this->Args[0],
- newName);
- mf.AddCommand(f);
+ mf.GetState()->RenameCommand(this->Args[0], newName);
+ mf.GetState()->AddCommand(f);
// remove the function blocker now that the macro is defined
mf.RemoveFunctionBlocker(this, lff);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index b1e67f4..be3bcdc 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -244,12 +244,6 @@ void cmMakefile::Print() const
#endif
}
-bool cmMakefile::CommandExists(const char* name) const
-{
- return this->GetCMakeInstance()->CommandExists(name);
-}
-
-
//----------------------------------------------------------------------------
void cmMakefile::IssueMessage(cmake::MessageType t,
std::string const& text) const
@@ -340,7 +334,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
static_cast<void>(stack_manager);
// Lookup the command prototype.
- if(cmCommand* proto = this->GetCMakeInstance()->GetCommand(name))
+ if(cmCommand* proto = this->GetState()->GetCommand(name))
{
// Clone the prototype.
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
void cmMakefile::SetLocalGenerator(cmLocalGenerator* lg)
{
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 43c1b1a..299d550 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -746,14 +746,6 @@ public:
bool ExecuteCommand(const cmListFileFunction& lff,
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
///enabled.
void EnableLanguage(std::vector<std::string>const& languages, bool optional);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 89d5fea..a0f813e 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -1758,7 +1758,7 @@ void cmake::AddDefaultCommands()
for(std::vector<cmCommand*>::iterator i = commands.begin();
i != commands.end(); ++i)
{
- this->AddCommand(*i);
+ this->State->AddCommand(*i);
}
}