summaryrefslogtreecommitdiff
path: root/Source/cmCMakePolicyCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-17 11:43:56 -0400
committerBrad King <brad.king@kitware.com>2018-04-18 08:09:56 -0400
commit391a5837ee859c749c2a988eb873a2a9a2c58f91 (patch)
tree478a42c6182f433142114e8b68c1cd6cda0d68c8 /Source/cmCMakePolicyCommand.cxx
parent3c47ac5b2571939f7d987d9f23a9969b1f67f46e (diff)
downloadcmake-391a5837ee859c749c2a988eb873a2a9a2c58f91.tar.gz
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/cmCMakePolicyCommand.cxx')
-rw-r--r--Source/cmCMakePolicyCommand.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx
index 7ca1cbcb43..adf9ef80ef 100644
--- a/Source/cmCMakePolicyCommand.cxx
+++ b/Source/cmCMakePolicyCommand.cxx
@@ -95,7 +95,11 @@ bool cmCMakePolicyCommand::HandleSetMode(std::vector<std::string> const& args)
bool cmCMakePolicyCommand::HandleGetMode(std::vector<std::string> const& args)
{
- if (args.size() != 3) {
+ bool parent_scope = false;
+ if (args.size() == 4 && args[3] == "PARENT_SCOPE") {
+ // Undocumented PARENT_SCOPE option for use within CMake.
+ parent_scope = true;
+ } else if (args.size() != 3) {
this->SetError("GET must be given exactly 2 additional arguments.");
return false;
}
@@ -115,7 +119,8 @@ bool cmCMakePolicyCommand::HandleGetMode(std::vector<std::string> const& args)
}
// Lookup the policy setting.
- cmPolicies::PolicyStatus status = this->Makefile->GetPolicyStatus(pid);
+ cmPolicies::PolicyStatus status =
+ this->Makefile->GetPolicyStatus(pid, parent_scope);
switch (status) {
case cmPolicies::OLD:
// Report that the policy is set to OLD.