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

Method ParseGeneratorInstance

Source/cmGlobalVisualStudioVersionedGenerator.cxx:640–711  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

638}
639
640bool cmGlobalVisualStudioVersionedGenerator::ParseGeneratorInstance(
641 std::string const& is, cmMakefile* mf)
642{
643 this->GeneratorInstance.clear();
644 this->GeneratorInstanceVersion.clear();
645
646 std::vector<std::string> const fields =
647 cmTokenize(is, ',', cmTokenizerMode::New);
648 if (fields.empty()) {
649 return true;
650 }
651
652 auto fi = fields.begin();
653 // The first field may be the VS instance.
654 if (fi->find('=') == fi->npos) {
655 this->GeneratorInstance = *fi;
656 ++fi;
657 }
658
659 std::set<std::string> handled;
660
661 // The rest of the fields must be key=value pairs.
662 for (; fi != fields.end(); ++fi) {
663 std::string::size_type pos = fi->find('=');
664 if (pos == fi->npos) {
665 mf->IssueMessage(
666 MessageType::FATAL_ERROR,
667 cmStrCat("Generator\n"
668 " ",
669 this->GetName(),
670 "\n"
671 "given instance specification\n"
672 " ",
673 is,
674 "\n"
675 "that contains a field after the first ',' with no '='."));
676 return false;
677 }
678 std::string const key = fi->substr(0, pos);
679 std::string const value = fi->substr(pos + 1);
680 if (!handled.insert(key).second) {
681 mf->IssueMessage(MessageType::FATAL_ERROR,
682 cmStrCat("Generator\n"
683 " ",
684 this->GetName(),
685 "\n"
686 "given instance specification\n"
687 " ",
688 is,
689 "\n"
690 "that contains duplicate field key '",
691 key, "'."));
692 return false;
693 }
694 if (!this->ProcessGeneratorInstanceField(key, value)) {
695 mf->IssueMessage(MessageType::FATAL_ERROR,
696 cmStrCat("Generator\n"
697 " ",

Callers 1

SetGeneratorInstanceMethod · 0.95

Calls 12

cmTokenizeFunction · 0.85
cmStrCatFunction · 0.70
clearMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45
findMethod · 0.45
endMethod · 0.45
IssueMessageMethod · 0.45
GetNameMethod · 0.45
substrMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected