summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-01-22 18:16:27 (GMT)
committerBrad King <brad.king@kitware.com>2009-01-22 18:16:27 (GMT)
commit26bf8b2cda2f7aec429ac478c8ef1b9dbf436142 (patch)
tree5beae10e84662815dfc13bc3a6faab41fc747a94 /Source/cmMakefile.cxx
parent3a4f76949acb99b53380c738a25c7bae4ba317c9 (diff)
downloadCMake-26bf8b2cda2f7aec429ac478c8ef1b9dbf436142.zip
CMake-26bf8b2cda2f7aec429ac478c8ef1b9dbf436142.tar.gz
CMake-26bf8b2cda2f7aec429ac478c8ef1b9dbf436142.tar.bz2
ENH: Create notion of a 'weak' policy stack entry
A 'weak' poilcy stack entry responds normally to queries. However, setting a policy in a weak entry will recursively set the policy in the next entry too. This also gives the internal interface to create a weak entry the option to provide an initial PolicyMap for it.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx19
1 files changed, 13 insertions, 6 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 8fc4210..25d97fa 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3666,8 +3666,14 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
return false;
}
- // Store the setting.
- this->PolicyStack.back()[id] = status;
+ // Update the policy stack from the top to the top-most strong entry.
+ bool previous_was_weak = true;
+ for(PolicyStackType::reverse_iterator psi = this->PolicyStack.rbegin();
+ previous_was_weak && psi != this->PolicyStack.rend(); ++psi)
+ {
+ (*psi)[id] = status;
+ previous_was_weak = psi->Weak;
+ }
// Special hook for presenting compatibility variable as soon as
// the user requests it.
@@ -3692,10 +3698,11 @@ bool cmMakefile::SetPolicy(cmPolicies::PolicyID id,
}
//----------------------------------------------------------------------------
-cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m):
+cmMakefile::PolicyPushPop::PolicyPushPop(cmMakefile* m, bool weak,
+ cmPolicies::PolicyMap const& pm):
Makefile(m), ReportError(true)
{
- this->Makefile->PushPolicy();
+ this->Makefile->PushPolicy(weak, pm);
this->Makefile->PushPolicyBarrier();
}
@@ -3707,10 +3714,10 @@ cmMakefile::PolicyPushPop::~PolicyPushPop()
}
//----------------------------------------------------------------------------
-void cmMakefile::PushPolicy()
+void cmMakefile::PushPolicy(bool weak, cmPolicies::PolicyMap const& pm)
{
// Allocate a new stack entry.
- this->PolicyStack.push_back(PolicyStackEntry());
+ this->PolicyStack.push_back(PolicyStackEntry(pm, weak));
}
//----------------------------------------------------------------------------