MCPcopy Create free account
hub / github.com/Kitware/CMake / cmMarkAsAdvancedCommand

Function cmMarkAsAdvancedCommand

Source/cmMarkAsAdvancedCommand.cxx:17–100  ·  view source on GitHub ↗

cmMarkAsAdvancedCommand

Source from the content-addressed store, hash-verified

15
16// cmMarkAsAdvancedCommand
17bool 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

Callers

nothing calls this directly

Calls 15

cmStrCatFunction · 0.70
ErrorClass · 0.70
emptyMethod · 0.45
SetErrorMethod · 0.45
GetMakefileMethod · 0.45
GetStateMethod · 0.45
sizeMethod · 0.45
GetPolicyStatusMethod · 0.45
GetCacheEntryValueMethod · 0.45
IssueMessageMethod · 0.45
AddCacheEntryMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…