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

Method ParseArguments

Source/cmFindBase.cxx:48–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
49{
50 if (argsIn.size() < 2) {
51 this->SetError("called with incorrect number of arguments");
52 return false;
53 }
54
55 // copy argsIn into args so it can be modified,
56 // in the process extract the DOC "documentation"
57 // and handle options NO_CACHE and ENV
58 size_t size = argsIn.size();
59 std::vector<std::string> args;
60 bool foundDoc = false;
61 for (unsigned int j = 0; j < size; ++j) {
62 if (foundDoc || argsIn[j] != "DOC") {
63 if (argsIn[j] == "NO_CACHE") {
64 this->StoreResultInCache = false;
65 } else if (argsIn[j] == "ENV") {
66 if (j + 1 < size) {
67 j++;
68 std::vector<std::string> p =
69 cmSystemTools::GetEnvPathNormalized(argsIn[j]);
70 std::move(p.begin(), p.end(), std::back_inserter(args));
71 }
72 } else {
73 args.push_back(argsIn[j]);
74 }
75 } else {
76 if (j + 1 < size) {
77 foundDoc = true;
78 this->VariableDocumentation = argsIn[j + 1];
79 j++;
80 if (j >= size) {
81 break;
82 }
83 }
84 }
85 }
86 if (args.size() < 2) {
87 this->SetError("called with incorrect number of arguments");
88 return false;
89 }
90 this->VariableName = args[0];
91 this->InitialState = this->GetInitialState();
92 if (this->IsFound()) {
93 if (this->DebugState) {
94 this->DebugState->FoundAt(
95 *this->Makefile->GetDefinition(this->VariableName));
96 }
97 return true;
98 }
99
100 // Find what search path locations have been enabled/disable
101 this->SelectDefaultSearchModes();
102
103 // Find the current root path mode.
104 this->SelectDefaultRootPathMode();
105

Callers 3

InitialPassMethod · 0.45
InitialPassMethod · 0.45
InitialPassMethod · 0.45

Calls 15

GetInitialStateMethod · 0.95
IsFoundMethod · 0.95
ExpandPathsMethod · 0.95
moveFunction · 0.85
StrucmpFunction · 0.85
cmMakeRangeFunction · 0.85
appendFunction · 0.85
push_backMethod · 0.80
FoundAtMethod · 0.80
SelectDefaultMacModeMethod · 0.80

Tested by

no test coverage detected