ENH: small simple projects do not need to specify cmake minimum required

This commit is contained in:
Ken Martin 2008-03-20 10:40:24 -04:00
parent 36c37a60b0
commit a568a8552d
1 changed files with 35 additions and 1 deletions

View File

@ -134,8 +134,41 @@ bool cmListFile::ParseFile(const char* filename,
break;
}
}
// if no version command is found this is a warning or error
// if no policy command is found this is an error if they use any non advanced functions or a lot of functions
if(!hasVersion)
{
bool isProblem = true;
if (this->Functions.size() < 30)
{
// the list of simple commands DO NOT ADD TO THIS LIST!!!!!
// these commands must have backwards compatibility forever and
// and that is a lot longer than your tiny mind can comprehend mortal
std::set<std::string> allowedCommands;
allowedCommands.insert("project");
allowedCommands.insert("set");
allowedCommands.insert("if");
allowedCommands.insert("endif");
allowedCommands.insert("else");
allowedCommands.insert("elseif");
allowedCommands.insert("add_executable");
allowedCommands.insert("add_library");
allowedCommands.insert("target_link_libraries");
allowedCommands.insert("option");
allowedCommands.insert("message");
isProblem = false;
for(std::vector<cmListFileFunction>::iterator i
= this->Functions.begin();
i != this->Functions.end(); ++i)
{
std::string name = cmSystemTools::LowerCase(i->Name);
if (allowedCommands.find(name) == allowedCommands.end())
{
isProblem = true;
}
}
}
if (isProblem)
{
cmOStringStream msg;
msg << "No cmake_minimum_required command is present. "
@ -162,6 +195,7 @@ bool cmListFile::ParseFile(const char* filename,
return false;
}
}
}
}
if(topLevel)