summaryrefslogtreecommitdiffstats
path: root/Source/cmStateSnapshot.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-17 15:43:56 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-18 12:09:56 (GMT)
commit391a5837ee859c749c2a988eb873a2a9a2c58f91 (patch)
tree478a42c6182f433142114e8b68c1cd6cda0d68c8 /Source/cmStateSnapshot.cxx
parent3c47ac5b2571939f7d987d9f23a9969b1f67f46e (diff)
downloadCMake-391a5837ee859c749c2a988eb873a2a9a2c58f91.zip
CMake-391a5837ee859c749c2a988eb873a2a9a2c58f91.tar.gz
CMake-391a5837ee859c749c2a988eb873a2a9a2c58f91.tar.bz2
cmake_policy: Add undocumented PARENT_SCOPE option to GET
Policies affecting the behavior of CMake-provided macros and functions need to be able to get the policy setting as of the call site rather than the definition site. Add an undocumented option to do this.
Diffstat (limited to 'Source/cmStateSnapshot.cxx')
-rw-r--r--Source/cmStateSnapshot.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/cmStateSnapshot.cxx b/Source/cmStateSnapshot.cxx
index 0d97c33..0229a77 100644
--- a/Source/cmStateSnapshot.cxx
+++ b/Source/cmStateSnapshot.cxx
@@ -160,8 +160,8 @@ void cmStateSnapshot::SetPolicy(cmPolicies::PolicyID id,
}
}
-cmPolicies::PolicyStatus cmStateSnapshot::GetPolicy(
- cmPolicies::PolicyID id) const
+cmPolicies::PolicyStatus cmStateSnapshot::GetPolicy(cmPolicies::PolicyID id,
+ bool parent_scope) const
{
cmPolicies::PolicyStatus status = cmPolicies::GetPolicyStatus(id);
@@ -180,6 +180,10 @@ cmPolicies::PolicyStatus cmStateSnapshot::GetPolicy(
cmLinkedTree<cmStateDetail::PolicyStackEntry>::iterator root =
dir->DirectoryEnd->PolicyRoot;
for (; leaf != root; ++leaf) {
+ if (parent_scope) {
+ parent_scope = false;
+ continue;
+ }
if (leaf->IsDefined(id)) {
status = leaf->Get(id);
return status;