diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 00b23cd85..a9cabf18d 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 cmlg(cmgg.CreateLocalGenerator()); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 379295379..783941b74 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 0e84fbf8b..c50ea884e 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 6134c6f60..77cd6c687 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(arg); - return static_cast(mf->CommandExists(name)); + return static_cast(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 eb4f3a131..0a71c60a6 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 9297688c5..fdd1018e6 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 cdfd00c9f..403f7fcc8 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 b7cbae6e3..7ac44320c 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 b1e67f4bf..be3bcdcb0 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(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 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 43c1b1a6b..299d550a2 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::vectorconst& languages, bool optional); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 89d5feac8..a0f813ecb 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1758,7 +1758,7 @@ void cmake::AddDefaultCommands() for(std::vector::iterator i = commands.begin(); i != commands.end(); ++i) { - this->AddCommand(*i); + this->State->AddCommand(*i); } }