summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-07-27 13:31:18 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-07-27 13:31:18 (GMT)
commitcb21c548db00560b4aa226606f2f1e80d45deb15 (patch)
treeeae4929f465b9023b4ae50bad054b4e9c247d86b /Source/cmMakefile.cxx
parentd74abbea895d032e5b4efa43854ad57417b8ab40 (diff)
parent8329fc016fd0b6e82b9bc1da9e857206d11b9bbe (diff)
downloadCMake-cb21c548db00560b4aa226606f2f1e80d45deb15.zip
CMake-cb21c548db00560b4aa226606f2f1e80d45deb15.tar.gz
CMake-cb21c548db00560b4aa226606f2f1e80d45deb15.tar.bz2
Merge topic 'policy-refactor'
8329fc01 cmPolicies: Replace unused include. 5447ca1a cmMakefile: Remove CMP0001 handling to callers. d0dcce15 cmMakefile: Simplify computation of ancient policy status. 658bfc5c cmMakefile: Remove redundant condition from policy status computation. f4a25874 cmMakefile: Inline internal policy status method. 3c45471c cmPolicies: Enable RVO for internal method. 71e69fc9 cmPolicies: Store only state that users can set. 84e18056 cmMakefile: Convert recursion to loop.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx74
1 files changed, 16 insertions, 58 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9a28c7c..e07701f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4736,53 +4736,30 @@ 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);
+ cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(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(status == cmPolicies::REQUIRED_ALWAYS ||
+ status == cmPolicies::REQUIRED_IF_USED)
{
- 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;
- }
+ return status;
}
- // The current setting is okay.
- return cur;
-}
-
-//----------------------------------------------------------------------------
-cmPolicies::PolicyStatus
-cmMakefile::GetPolicyStatusInternal(cmPolicies::PolicyID id) const
-{
- // Is the policy set in our stack?
- for(PolicyStackType::const_reverse_iterator psi = this->PolicyStack.rbegin();
- psi != this->PolicyStack.rend(); ++psi)
+ cmLocalGenerator* lg = this->LocalGenerator;
+ while(lg)
{
- if(psi->IsDefined(id))
+ cmMakefile const* mf = lg->GetMakefile();
+ for(PolicyStackType::const_reverse_iterator psi =
+ mf->PolicyStack.rbegin(); psi != mf->PolicyStack.rend(); ++psi)
{
- return psi->Get(id);
+ if(psi->IsDefined(id))
+ {
+ status = psi->Get(id);
+ return status;
+ }
}
+ lg = lg->GetParent();
}
-
- // If we have a parent directory, recurse up to it.
- if(this->LocalGenerator->GetParent())
- {
- cmMakefile* parent = this->LocalGenerator->GetParent()->GetMakefile();
- return parent->GetPolicyStatusInternal(id);
- }
-
- // The policy is not set. Use the default for this CMake version.
- return cmPolicies::GetPolicyStatus(id);
+ return status;
}
//----------------------------------------------------------------------------
@@ -4839,25 +4816,6 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
previous_was_weak = psi->Weak;
}
- // Special hook for presenting compatibility variable as soon as
- // the user requests it.
- if(id == cmPolicies::CMP0001 &&
- (status == cmPolicies::WARN || status == cmPolicies::OLD))
- {
- if(!(this->GetState()
- ->GetInitializedCacheValue("CMAKE_BACKWARDS_COMPATIBILITY")))
- {
- // Set it to 2.4 because that is the last version where the
- // variable had meaning.
- this->AddCacheDefinition
- ("CMAKE_BACKWARDS_COMPATIBILITY", "2.4",
- "For backwards compatibility, what version of CMake "
- "commands and "
- "syntax should this version of CMake try to support.",
- cmState::STRING);
- }
- }
-
return true;
}