| 115 | } |
| 116 | |
| 117 | bool cmGlobalVisualStudio8Generator::ParseGeneratorPlatform( |
| 118 | std::string const& p, cmMakefile* mf) |
| 119 | { |
| 120 | this->GeneratorPlatform.clear(); |
| 121 | |
| 122 | std::vector<std::string> const fields = |
| 123 | cmTokenize(p, ',', cmTokenizerMode::New); |
| 124 | if (fields.empty()) { |
| 125 | return true; |
| 126 | } |
| 127 | |
| 128 | auto fi = fields.begin(); |
| 129 | // The first field may be the VS platform. |
| 130 | if (fi->find('=') == fi->npos) { |
| 131 | this->GeneratorPlatform = *fi; |
| 132 | ++fi; |
| 133 | } |
| 134 | |
| 135 | std::set<std::string> handled; |
| 136 | |
| 137 | // The rest of the fields must be key=value pairs. |
| 138 | for (; fi != fields.end(); ++fi) { |
| 139 | std::string::size_type pos = fi->find('='); |
| 140 | if (pos == fi->npos) { |
| 141 | std::ostringstream e; |
| 142 | /* clang-format off */ |
| 143 | e << |
| 144 | "Generator\n" |
| 145 | " " << this->GetName() << "\n" |
| 146 | "given platform specification\n" |
| 147 | " " << p << "\n" |
| 148 | "that contains a field after the first ',' with no '='." |
| 149 | ; |
| 150 | /* clang-format on */ |
| 151 | mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); |
| 152 | return false; |
| 153 | } |
| 154 | std::string const key = fi->substr(0, pos); |
| 155 | std::string const value = fi->substr(pos + 1); |
| 156 | if (!handled.insert(key).second) { |
| 157 | std::ostringstream e; |
| 158 | /* clang-format off */ |
| 159 | e << |
| 160 | "Generator\n" |
| 161 | " " << this->GetName() << "\n" |
| 162 | "given platform specification\n" |
| 163 | " " << p << "\n" |
| 164 | "that contains duplicate field key '" << key << "'." |
| 165 | ; |
| 166 | /* clang-format on */ |
| 167 | mf->IssueMessage(MessageType::FATAL_ERROR, e.str()); |
| 168 | return false; |
| 169 | } |
| 170 | if (!this->ProcessGeneratorPlatformField(key, value)) { |
| 171 | std::ostringstream e; |
| 172 | /* clang-format off */ |
| 173 | e << |
| 174 | "Generator\n" |
no test coverage detected