cmMakefile: Handle CMP0014 before configuring the generator.
This commit is contained in:
parent
7baef75649
commit
ce167b546d
@ -192,43 +192,8 @@ void cmLocalGenerator::ReadInputFile()
|
|||||||
// Look for the CMakeLists.txt file.
|
// Look for the CMakeLists.txt file.
|
||||||
std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory();
|
std::string currentStart = this->StateSnapshot.GetCurrentSourceDirectory();
|
||||||
currentStart += "/CMakeLists.txt";
|
currentStart += "/CMakeLists.txt";
|
||||||
if(cmSystemTools::FileExists(currentStart.c_str(), true))
|
assert(cmSystemTools::FileExists(currentStart.c_str(), true));
|
||||||
{
|
this->Makefile->ProcessBuildsystemFile(currentStart.c_str());
|
||||||
this->Makefile->ProcessBuildsystemFile(currentStart.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(this->Parent);
|
|
||||||
|
|
||||||
// The file is missing. Check policy CMP0014.
|
|
||||||
cmMakefile* mf = this->Parent->GetMakefile();
|
|
||||||
std::ostringstream e;
|
|
||||||
e << "The source directory\n"
|
|
||||||
<< " " << this->StateSnapshot.GetCurrentSourceDirectory() << "\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"
|
|
||||||
<< cmPolicies::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"
|
|
||||||
<< cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0014);
|
|
||||||
case cmPolicies::NEW:
|
|
||||||
// NEW behavior prints the error.
|
|
||||||
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmLocalGenerator::SetupPathConversions()
|
void cmLocalGenerator::SetupPathConversions()
|
||||||
@ -3340,6 +3305,11 @@ bool cmLocalGenerator::IsNMake() const
|
|||||||
return this->GlobalGenerator->NMake;
|
return this->GlobalGenerator->NMake;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmLocalGenerator::SetConfiguredCMP0014(bool configured)
|
||||||
|
{
|
||||||
|
this->Configured = configured;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string
|
std::string
|
||||||
cmLocalGenerator
|
cmLocalGenerator
|
||||||
|
@ -391,6 +391,8 @@ public:
|
|||||||
bool IsMinGWMake() const;
|
bool IsMinGWMake() const;
|
||||||
bool IsNMake() const;
|
bool IsNMake() const;
|
||||||
|
|
||||||
|
void SetConfiguredCMP0014(bool configured);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
///! put all the libraries for a target on into the given stream
|
///! put all the libraries for a target on into the given stream
|
||||||
virtual void OutputLinkLibraries(std::string& linkLibraries,
|
virtual void OutputLinkLibraries(std::string& linkLibraries,
|
||||||
|
@ -1642,12 +1642,47 @@ void cmMakefile::InitializeFromParent()
|
|||||||
void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
|
void cmMakefile::ConfigureSubDirectory(cmLocalGenerator *lg2)
|
||||||
{
|
{
|
||||||
lg2->GetMakefile()->InitializeFromParent();
|
lg2->GetMakefile()->InitializeFromParent();
|
||||||
|
std::string currentStart = lg2->GetMakefile()->GetCurrentSourceDirectory();
|
||||||
if (this->GetCMakeInstance()->GetDebugOutput())
|
if (this->GetCMakeInstance()->GetDebugOutput())
|
||||||
{
|
{
|
||||||
std::string msg=" Entering ";
|
std::string msg=" Entering ";
|
||||||
msg += lg2->GetMakefile()->GetCurrentSourceDirectory();
|
msg += currentStart;
|
||||||
cmSystemTools::Message(msg.c_str());
|
cmSystemTools::Message(msg.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentStart += "/CMakeLists.txt";
|
||||||
|
if(!cmSystemTools::FileExists(currentStart.c_str(), true))
|
||||||
|
{
|
||||||
|
// The file is missing. Check policy CMP0014.
|
||||||
|
std::ostringstream e;
|
||||||
|
e << "The source directory\n"
|
||||||
|
<< " " << currentStart << "\n"
|
||||||
|
<< "does not contain a CMakeLists.txt file.";
|
||||||
|
switch (this->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"
|
||||||
|
<< cmPolicies::GetPolicyWarning(cmPolicies::CMP0014);
|
||||||
|
this->IssueMessage(cmake::AUTHOR_WARNING, e.str());
|
||||||
|
case cmPolicies::OLD:
|
||||||
|
// OLD behavior does not warn.
|
||||||
|
break;
|
||||||
|
case cmPolicies::REQUIRED_IF_USED:
|
||||||
|
case cmPolicies::REQUIRED_ALWAYS:
|
||||||
|
e << "\n"
|
||||||
|
<< cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0014);
|
||||||
|
case cmPolicies::NEW:
|
||||||
|
// NEW behavior prints the error.
|
||||||
|
this->IssueMessage(cmake::FATAL_ERROR, e.str());
|
||||||
|
}
|
||||||
|
lg2->SetConfiguredCMP0014(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
// finally configure the subdir
|
// finally configure the subdir
|
||||||
lg2->Configure();
|
lg2->Configure();
|
||||||
if (this->GetCMakeInstance()->GetDebugOutput())
|
if (this->GetCMakeInstance()->GetDebugOutput())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user