diff options
author | Brad King <brad.king@kitware.com> | 2018-04-17 15:43:56 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-04-18 12:09:56 (GMT) |
commit | 391a5837ee859c749c2a988eb873a2a9a2c58f91 (patch) | |
tree | 478a42c6182f433142114e8b68c1cd6cda0d68c8 /Source/cmCMakePolicyCommand.cxx | |
parent | 3c47ac5b2571939f7d987d9f23a9969b1f67f46e (diff) | |
download | CMake-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/cmCMakePolicyCommand.cxx')
-rw-r--r-- | Source/cmCMakePolicyCommand.cxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/cmCMakePolicyCommand.cxx b/Source/cmCMakePolicyCommand.cxx index 7ca1cbc..adf9ef8 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. |