cmMarkAsAdvancedCommand
| 15 | |
| 16 | // cmMarkAsAdvancedCommand |
| 17 | bool cmMarkAsAdvancedCommand(std::vector<std::string> const& args, |
| 18 | cmExecutionStatus& status) |
| 19 | { |
| 20 | if (args.empty()) { |
| 21 | status.SetError("called with incorrect number of arguments"); |
| 22 | return false; |
| 23 | } |
| 24 | |
| 25 | unsigned int i = 0; |
| 26 | char const* value = "1"; |
| 27 | bool overwrite = false; |
| 28 | if (args[0] == "CLEAR" || args[0] == "FORCE") { |
| 29 | overwrite = true; |
| 30 | if (args[0] == "CLEAR") { |
| 31 | value = "0"; |
| 32 | } |
| 33 | i = 1; |
| 34 | } |
| 35 | |
| 36 | cmMakefile& mf = status.GetMakefile(); |
| 37 | cmState* state = mf.GetState(); |
| 38 | |
| 39 | for (; i < args.size(); ++i) { |
| 40 | std::string const& variable = args[i]; |
| 41 | |
| 42 | bool issueMessage = false; |
| 43 | bool oldBehavior = false; |
| 44 | bool ignoreVariable = false; |
| 45 | switch (mf.GetPolicyStatus(cmPolicies::CMP0102)) { |
| 46 | case cmPolicies::WARN: |
| 47 | if (mf.PolicyOptionalWarningEnabled("CMAKE_POLICY_WARNING_CMP0102")) { |
| 48 | if (!state->GetCacheEntryValue(variable)) { |
| 49 | issueMessage = true; |
| 50 | } |
| 51 | } |
| 52 | CM_FALLTHROUGH; |
| 53 | case cmPolicies::OLD: |
| 54 | oldBehavior = true; |
| 55 | break; |
| 56 | case cmPolicies::NEW: |
| 57 | if (!state->GetCacheEntryValue(variable)) { |
| 58 | ignoreVariable = true; |
| 59 | } |
| 60 | break; |
| 61 | } |
| 62 | |
| 63 | // First see if we should issue a message about CMP0102 |
| 64 | if (issueMessage) { |
| 65 | std::string err = cmStrCat( |
| 66 | "Policy CMP0102 is not set: The variable named \"", variable, |
| 67 | "\" is not in the cache. This results in an empty cache entry which " |
| 68 | "is no longer created when policy CMP0102 is set to NEW. Run \"cmake " |
| 69 | "--help-policy CMP0102\" for policy details. Use the cmake_policy " |
| 70 | "command to set the policy and suppress this warning."); |
| 71 | mf.IssueMessage(MessageType::AUTHOR_WARNING, err); |
| 72 | } |
| 73 | |
| 74 | // If it's not in the cache and we're using the new behavior, nothing to |
nothing calls this directly
no test coverage detected
searching dependent graphs…