summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx42
1 files changed, 41 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 65ea7e7..4d7bfdb 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -167,9 +167,49 @@ void cmLocalGenerator::ComputeObjectMaxPath()
//----------------------------------------------------------------------------
void cmLocalGenerator::ReadInputFile()
{
+ // Look for the CMakeLists.txt file.
std::string currentStart = this->Makefile->GetStartDirectory();
currentStart += "/CMakeLists.txt";
- this->Makefile->ReadListFile(currentStart.c_str());
+ if(cmSystemTools::FileExists(currentStart.c_str(), true))
+ {
+ this->Makefile->ReadListFile(currentStart.c_str());
+ return;
+ }
+
+ if(!this->Parent)
+ {
+ return;
+ }
+
+ // The file is missing. Check policy CMP0014.
+ cmMakefile* mf = this->Parent->GetMakefile();
+ cmOStringStream e;
+ e << "The source directory\n"
+ << " " << this->Makefile->GetStartDirectory() << "\n"
+ << "does not contain a CMakeLists.txt file.";
+ switch (mf->GetPolicyStatus(cmPolicies::CMP0014))
+ {
+ case cmPolicies::WARN:
+ // Print the warning.
+ e << "\n"
+ << "CMake does not support this case but it used "
+ << "to work accidentally and is being allowed for "
+ << "compatibility."
+ << "\n"
+ << mf->GetPolicies()->GetPolicyWarning(cmPolicies::CMP0014);
+ mf->IssueMessage(cmake::AUTHOR_WARNING, e.str());
+ case cmPolicies::OLD:
+ // OLD behavior does not warn.
+ return;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ e << "\n"
+ << mf->GetPolicies()->GetRequiredPolicyError(cmPolicies::CMP0014);
+ case cmPolicies::NEW:
+ // NEW behavior prints the error.
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ break;
+ }
}
void cmLocalGenerator::SetupPathConversions()