diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-04-11 12:52:14 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-04-15 11:43:49 -0400 |
commit | 0aec49132885be07e1d92a4a1db58f4c6c4c2844 (patch) | |
tree | ba5db3057c7431795a8aa9762f0cfbc5f252e406 | |
parent | 96f8c5f9a3bd60f553af054b43e06ce4864269e0 (diff) | |
download | cmake-0aec49132885be07e1d92a4a1db58f4c6c4c2844.tar.gz |
Port cmCommand consumers to cmState.
-rw-r--r-- | Source/CPack/cpack.cxx | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestScriptHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 8 | ||||
-rw-r--r-- | Source/cmCPluginAPI.cxx | 2 | ||||
-rw-r--r-- | Source/cmConditionEvaluator.cxx | 4 | ||||
-rw-r--r-- | Source/cmFunctionCommand.cxx | 5 | ||||
-rw-r--r-- | Source/cmLoadCommandCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmMacroCommand.cxx | 5 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 13 | ||||
-rw-r--r-- | Source/cmMakefile.h | 8 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 |
11 files changed, 18 insertions, 37 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 00b23cd850..a9cabf18d2 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 3792953790..783941b747 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 0e84fbf8bb..c50ea884e7 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 6134c6f60f..77cd6c6877 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 eb4f3a1313..0a71c60a67 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 9297688c5c..fdd1018e6b 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 cdfd00c9f6..403f7fcc84 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 b7cbae6e3e..7ac44320c4 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 b1e67f4bf9..be3bcdcb04 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 43c1b1a6b9..299d550a27 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 89d5feac89..a0f813ecb9 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); } } |