|
@@ -565,9 +565,14 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
|
|
|
{
|
|
{
|
|
|
ancientPolicies.push_back(i->first);
|
|
ancientPolicies.push_back(i->first);
|
|
|
}
|
|
}
|
|
|
- else if (!mf->SetPolicy(i->second->ID, cmPolicies::WARN))
|
|
|
|
|
|
|
+ else
|
|
|
{
|
|
{
|
|
|
- return false;
|
|
|
|
|
|
|
+ cmPolicies::PolicyStatus status = cmPolicies::WARN;
|
|
|
|
|
+ if(!this->GetPolicyDefault(mf, i->second->IDString, &status) ||
|
|
|
|
|
+ !mf->SetPolicy(i->second->ID, status))
|
|
|
|
|
+ {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
@@ -591,6 +596,36 @@ bool cmPolicies::ApplyPolicyVersion(cmMakefile *mf,
|
|
|
return true;
|
|
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.c_str());
|
|
|
|
|
+ if(defaultValue == "NEW")
|
|
|
|
|
+ {
|
|
|
|
|
+ *defaultSetting = cmPolicies::NEW;
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(defaultValue == "OLD")
|
|
|
|
|
+ {
|
|
|
|
|
+ *defaultSetting = cmPolicies::OLD;
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(defaultValue == "")
|
|
|
|
|
+ {
|
|
|
|
|
+ *defaultSetting = cmPolicies::WARN;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ cmOStringStream e;
|
|
|
|
|
+ e << defaultVar << " has value \"" << defaultValue
|
|
|
|
|
+ << "\" but must be \"OLD\", \"NEW\", or \"\" (empty).";
|
|
|
|
|
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return true;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
|
|
bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid)
|
|
|
{
|
|
{
|
|
|
if (!id || strlen(id) < 1)
|
|
if (!id || strlen(id) < 1)
|