diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cae7bbc07..7a35a26af 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4741,34 +4741,6 @@ const char* cmMakefile::GetDefineFlagsCMP0059() const //---------------------------------------------------------------------------- cmPolicies::PolicyStatus cmMakefile::GetPolicyStatus(cmPolicies::PolicyID id) const -{ - // Get the current setting of the policy. - cmPolicies::PolicyStatus cur = this->GetPolicyStatusInternal(id); - - // If the policy is required to be set to NEW but is not, ignore the - // current setting and tell the caller. - if(cur != cmPolicies::NEW) - { - if(cur == cmPolicies::REQUIRED_ALWAYS || - cur == cmPolicies::REQUIRED_IF_USED) - { - return cur; - } - cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id); - if(def == cmPolicies::REQUIRED_ALWAYS || - def == cmPolicies::REQUIRED_IF_USED) - { - return def; - } - } - - // The current setting is okay. - return cur; -} - -//---------------------------------------------------------------------------- -cmPolicies::PolicyStatus -cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const { cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id); cmLocalGenerator* lg = this->LocalGenerator; @@ -4787,7 +4759,24 @@ cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const lg = lg->GetParent(); } - // The policy is not set. Use the default for this CMake version. + // If the policy is required to be set to NEW but is not, ignore the + // current setting and tell the caller. + if(status != cmPolicies::NEW) + { + if(status == cmPolicies::REQUIRED_ALWAYS || + status == cmPolicies::REQUIRED_IF_USED) + { + return status; + } + cmPolicies::PolicyStatus def = cmPolicies::GetPolicyStatus(id); + if(def == cmPolicies::REQUIRED_ALWAYS || + def == cmPolicies::REQUIRED_IF_USED) + { + return def; + } + } + + // The current setting is okay. return status; } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 2fc4d78a8..6dbea89bc 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -938,8 +938,6 @@ private: typedef std::vector PolicyStackType; PolicyStackType PolicyStack; std::vector PolicyBarriers; - cmPolicies::PolicyStatus - GetPolicyStatusInternal(cmPolicies::PolicyID id) const; // CMP0053 == old cmake::MessageType ExpandVariablesInStringOld(