| 89 | } |
| 90 | |
| 91 | bool HandleGetMode(std::vector<std::string> const& args, |
| 92 | cmExecutionStatus& status) |
| 93 | { |
| 94 | bool parent_scope = false; |
| 95 | if (args.size() == 4 && args[3] == "PARENT_SCOPE") { |
| 96 | // Undocumented PARENT_SCOPE option for use within CMake. |
| 97 | parent_scope = true; |
| 98 | } else if (args.size() != 3) { |
| 99 | status.SetError("GET must be given exactly 2 additional arguments."); |
| 100 | return false; |
| 101 | } |
| 102 | |
| 103 | // Get arguments. |
| 104 | std::string const& id = args[1]; |
| 105 | std::string const& var = args[2]; |
| 106 | |
| 107 | // Lookup the policy number. |
| 108 | cmPolicies::PolicyID pid; |
| 109 | if (!cmPolicies::GetPolicyID(id.c_str(), pid)) { |
| 110 | status.SetError( |
| 111 | cmStrCat("GET given policy \"", id, |
| 112 | "\" which is not known to this version of CMake.")); |
| 113 | return false; |
| 114 | } |
| 115 | |
| 116 | // Lookup the policy setting. |
| 117 | cmPolicies::PolicyStatus policyStatus = |
| 118 | status.GetMakefile().GetPolicyStatus(pid, parent_scope); |
| 119 | switch (policyStatus) { |
| 120 | case cmPolicies::OLD: |
| 121 | // Report that the policy is set to OLD. |
| 122 | status.GetMakefile().AddDefinition(var, "OLD"); |
| 123 | break; |
| 124 | case cmPolicies::WARN: |
| 125 | // Report that the policy is not set. |
| 126 | status.GetMakefile().AddDefinition(var, ""); |
| 127 | break; |
| 128 | case cmPolicies::NEW: |
| 129 | // Report that the policy is set to NEW. |
| 130 | status.GetMakefile().AddDefinition(var, "NEW"); |
| 131 | break; |
| 132 | } |
| 133 | |
| 134 | return true; |
| 135 | } |
| 136 | |
| 137 | bool HandleVersionMode(std::vector<std::string> const& args, |
| 138 | cmExecutionStatus& status) |
no test coverage detected
searching dependent graphs…