cmPolicies: Make private method file-static.

This commit is contained in:
Stephen Kelly 2015-05-03 10:09:10 +02:00
parent 2c10494ab3
commit 953d1b00af
2 changed files with 31 additions and 35 deletions

View File

@ -408,6 +408,36 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD,
this->PolicyStringMap[idString] = iD;
}
//----------------------------------------------------------------------------
static bool GetPolicyDefault(cmMakefile* mf, std::string const& policy,
cmPolicies::PolicyStatus* defaultSetting)
{
std::string defaultVar = "CMAKE_POLICY_DEFAULT_" + policy;
std::string defaultValue = mf->GetSafeDefinition(defaultVar);
if(defaultValue == "NEW")
{
*defaultSetting = cmPolicies::NEW;
}
else if(defaultValue == "OLD")
{
*defaultSetting = cmPolicies::OLD;
}
else if(defaultValue == "")
{
*defaultSetting = cmPolicies::WARN;
}
else
{
std::ostringstream e;
e << defaultVar << " has value \"" << defaultValue
<< "\" but must be \"OLD\", \"NEW\", or \"\" (empty).";
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
return true;
}
//----------------------------------------------------------------------------
bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
const char *version)
@ -482,7 +512,7 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
else
{
cmPolicies::PolicyStatus status = cmPolicies::WARN;
if(!this->GetPolicyDefault(mf, i->second->IDString, &status) ||
if(!GetPolicyDefault(mf, i->second->IDString, &status) ||
!mf->SetPolicy(i->second->ID, status))
{
return false;
@ -510,36 +540,6 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
return true;
}
//----------------------------------------------------------------------------
bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy,
cmPolicies::PolicyStatus* defaultSetting)
{
std::string defaultVar = "CMAKE_POLICY_DEFAULT_" + policy;
std::string defaultValue = mf->GetSafeDefinition(defaultVar);
if(defaultValue == "NEW")
{
*defaultSetting = cmPolicies::NEW;
}
else if(defaultValue == "OLD")
{
*defaultSetting = cmPolicies::OLD;
}
else if(defaultValue == "")
{
*defaultSetting = cmPolicies::WARN;
}
else
{
std::ostringstream e;
e << defaultVar << " has value \"" << defaultValue
<< "\" but must be \"OLD\", \"NEW\", or \"\" (empty).";
mf->IssueMessage(cmake::FATAL_ERROR, e.str());
return false;
}
return true;
}
bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
{
if (!id || strlen(id) < 1)

View File

@ -164,10 +164,6 @@ public:
void DiagnoseAncientPolicies(std::vector<PolicyID> const& ancient,
unsigned int majorVer, unsigned int minorVer,
unsigned int patchVer, cmMakefile* mf);
bool GetPolicyDefault(cmMakefile* mf, std::string const& policy,
cmPolicies::PolicyStatus* defaultStatus);
};
#endif