ENH: Initial framework for deprecated commands

This commit is contained in:
Andy Cedilnik 2003-07-21 14:44:00 -04:00
parent 0e1de8a9f2
commit 18c6f9e0c5

View File

@ -196,6 +196,23 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff)
this->GetCMakeInstance()->GetCommand(name.c_str()); this->GetCMakeInstance()->GetCommand(name.c_str());
if(rm) if(rm)
{ {
const char* versionValue
= this->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
int major = 0;
int minor = 0;
if ( versionValue )
{
sscanf(versionValue, "%d.%d", &major, &minor);
}
if ( rm->IsDeprecated(major, minor) )
{
cmOStringStream error;
error << "Error in cmake code at\n"
<< lff.m_FilePath << ":" << lff.m_Line << ":\n"
<< rm->GetError();
cmSystemTools::Error(error.str().c_str());
return false;
}
cmCommand* usedCommand = rm->Clone(); cmCommand* usedCommand = rm->Clone();
usedCommand->SetMakefile(this); usedCommand->SetMakefile(this);
bool keepCommand = false; bool keepCommand = false;
@ -209,8 +226,8 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff)
{ {
cmOStringStream error; cmOStringStream error;
error << "Error in cmake code at\n" error << "Error in cmake code at\n"
<< lff.m_FilePath << ":" << lff.m_Line << ":\n" << lff.m_FilePath << ":" << lff.m_Line << ":\n"
<< usedCommand->GetError(); << usedCommand->GetError();
cmSystemTools::Error(error.str().c_str()); cmSystemTools::Error(error.str().c_str());
result = false; result = false;
} }