| 358 | } |
| 359 | |
| 360 | bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset( |
| 361 | std::string const& ts, cmMakefile* mf) |
| 362 | { |
| 363 | std::vector<std::string> const fields = |
| 364 | cmTokenize(ts, ',', cmTokenizerMode::New); |
| 365 | if (fields.empty()) { |
| 366 | return true; |
| 367 | } |
| 368 | |
| 369 | auto fi = fields.begin(); |
| 370 | // The first field may be the VS platform toolset. |
| 371 | if (fi->find('=') == fi->npos) { |
| 372 | this->GeneratorToolset = *fi; |
| 373 | ++fi; |
| 374 | } |
| 375 | |
| 376 | std::set<std::string> handled; |
| 377 | |
| 378 | // The rest of the fields must be key=value pairs. |
| 379 | for (; fi != fields.end(); ++fi) { |
| 380 | std::string::size_type pos = fi->find('='); |
| 381 | if (pos == fi->npos) { |
| 382 | mf->IssueMessage( |
| 383 | MessageType::FATAL_ERROR, |
| 384 | cmStrCat("Generator\n" |
| 385 | " ", |
| 386 | this->GetName(), |
| 387 | "\n" |
| 388 | "given toolset specification\n" |
| 389 | " ", |
| 390 | ts, |
| 391 | "\n" |
| 392 | "that contains a field after the first ',' with no '='.")); |
| 393 | return false; |
| 394 | } |
| 395 | std::string const key = fi->substr(0, pos); |
| 396 | std::string const value = fi->substr(pos + 1); |
| 397 | if (!handled.insert(key).second) { |
| 398 | mf->IssueMessage(MessageType::FATAL_ERROR, |
| 399 | cmStrCat("Generator\n" |
| 400 | " ", |
| 401 | this->GetName(), |
| 402 | "\n" |
| 403 | "given toolset specification\n" |
| 404 | " ", |
| 405 | ts, |
| 406 | "\n" |
| 407 | "that contains duplicate field key '", |
| 408 | key, "'.")); |
| 409 | return false; |
| 410 | } |
| 411 | if (!this->ProcessGeneratorToolsetField(key, value)) { |
| 412 | mf->IssueMessage(MessageType::FATAL_ERROR, |
| 413 | cmStrCat("Generator\n" |
| 414 | " ", |
| 415 | this->GetName(), |
| 416 | "\n" |
| 417 | "given toolset specification\n" |
no test coverage detected