ENH: Added backwards compatability.

This commit is contained in:
Brad King 2003-07-23 15:45:53 -04:00
parent 48aedb2ba3
commit 6f1a044018
1 changed files with 21 additions and 1 deletions

View File

@ -24,7 +24,7 @@ bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args)
this->SetError("called with incorrect number of arguments"); this->SetError("called with incorrect number of arguments");
return false; return false;
} }
// Get the source group with the given name. // Get the source group with the given name.
cmSourceGroup* sg = m_Makefile->GetSourceGroup(args[0].c_str()); cmSourceGroup* sg = m_Makefile->GetSourceGroup(args[0].c_str());
if(!sg) if(!sg)
@ -33,6 +33,26 @@ bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args)
sg = m_Makefile->GetSourceGroup(args[0].c_str()); sg = m_Makefile->GetSourceGroup(args[0].c_str());
} }
// If only two arguments are given, the pre-1.8 version of the
// command is being invoked.
if(args.size() == 2 && args[1] != "FILES")
{
const char* versionValue =
m_Makefile->GetDefinition("CMAKE_BACKWARDS_COMPATIBILITY");
if(atof(versionValue) > 1.6)
{
this->SetError("no longer accepts a two-argument form. Use the "
"REGULAR_EXPRESSION argument form instead, or set "
"CMAKE_BACKWARDS_COMPATIBILITY to 1.6 or less.\n");
return false;
}
else
{
sg->SetGroupRegex(args[1].c_str());
return true;
}
}
// Process arguments. // Process arguments.
bool doingFiles = false; bool doingFiles = false;
for(unsigned int i=1; i < args.size(); ++i) for(unsigned int i=1; i < args.size(); ++i)