diff options
author | Ken Martin <ken.martin@kitware.com> | 2008-03-20 14:40:24 (GMT) |
---|---|---|
committer | Ken Martin <ken.martin@kitware.com> | 2008-03-20 14:40:24 (GMT) |
commit | a568a8552dc8422978eeeaab3ad2d6494d198add (patch) | |
tree | a69119a2fbffd442bf18f18cec9c6317a2af0e6b | |
parent | 36c37a60b004c571bc4458dcefba2c6afcbd1c33 (diff) | |
download | CMake-a568a8552dc8422978eeeaab3ad2d6494d198add.zip CMake-a568a8552dc8422978eeeaab3ad2d6494d198add.tar.gz CMake-a568a8552dc8422978eeeaab3ad2d6494d198add.tar.bz2 |
ENH: small simple projects do not need to specify cmake minimum required
-rw-r--r-- | Source/cmListFileCache.cxx | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index f09ab10..c546f18 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -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) |