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

Method AddTargetConfiguration

Source/cmPackageInfoReader.cxx:633–674  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

631}
632
633void cmPackageInfoReader::AddTargetConfiguration(
634 cmTarget* target, cm::string_view configuration) const
635{
636 static std::string const icProp = "IMPORTED_CONFIGURATIONS";
637
638 std::string const& configUpper = cmSystemTools::UpperCase(configuration);
639
640 // Get existing list of imported configurations.
641 cmList configs;
642 if (cmValue v = target->GetProperty(icProp)) {
643 configs.assign(cmSystemTools::UpperCase(*v));
644 } else {
645 // If the existing list is empty, just add the new one and return.
646 target->SetProperty(icProp, configUpper);
647 return;
648 }
649
650 if (cm::contains(configs, configUpper)) {
651 // If the configuration is already listed, we don't need to do anything.
652 return;
653 }
654
655 // Add the new configuration.
656 configs.append(configUpper);
657
658 // Rebuild the configuration list by extracting any configuration in the
659 // default configurations and reinserting it at the beginning of the list
660 // according to the order of the default configurations.
661 std::vector<std::string> newConfigs;
662 for (std::string const& c : this->DefaultConfigurations) {
663 auto ci = std::find(configs.begin(), configs.end(), c);
664 if (ci != configs.end()) {
665 newConfigs.emplace_back(std::move(*ci));
666 configs.erase(ci);
667 }
668 }
669 for (std::string& c : configs) {
670 newConfigs.emplace_back(std::move(c));
671 }
672
673 target->SetProperty("IMPORTED_CONFIGURATIONS", cmJoin(newConfigs, ";"_s));
674}
675
676void cmPackageInfoReader::SetImportProperty(cmMakefile* makefile,
677 cmTarget* target,

Callers 1

SetTargetPropertiesMethod · 0.95

Calls 11

moveFunction · 0.85
assignMethod · 0.80
appendMethod · 0.80
emplace_backMethod · 0.80
eraseMethod · 0.80
cmJoinFunction · 0.70
findFunction · 0.50
GetPropertyMethod · 0.45
SetPropertyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected