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

Method WriteGroup

Source/cmLocalVisualStudio7Generator.cxx:1649–1812  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1647}
1648
1649bool cmLocalVisualStudio7Generator::WriteGroup(
1650 cmSourceGroup const* sg, cmGeneratorTarget* target, std::ostream& fout,
1651 std::string const& libName, std::vector<std::string> const& configs,
1652 AllConfigSources const& sources, cmSourceGroupFiles const& sourceGroupFiles)
1653{
1654 cmGlobalVisualStudio7Generator* gg =
1655 static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
1656 std::vector<cmSourceFile const*> const& sourceFiles =
1657 sourceGroupFiles.GetSourceFiles(sg);
1658 SourceGroupVector const& children = sg->GetGroupChildren();
1659
1660 // Write the children to temporary output.
1661 bool hasChildrenWithSources = false;
1662 std::ostringstream tmpOut;
1663 for (auto const& child : children) {
1664 if (this->WriteGroup(child.get(), target, tmpOut, libName, configs,
1665 sources, sourceGroupFiles)) {
1666 hasChildrenWithSources = true;
1667 }
1668 }
1669
1670 // If the group is empty, don't write it at all.
1671 if (sourceFiles.empty() && !hasChildrenWithSources) {
1672 return false;
1673 }
1674
1675 // If the group has a name, write the header.
1676 std::string const& name = sg->GetName();
1677 if (!name.empty()) {
1678 this->WriteVCProjBeginGroup(fout, name.c_str(), "");
1679 }
1680
1681 auto& sourcesVisited = this->GetSourcesVisited(target);
1682
1683 // Loop through each source in the source group.
1684 for (cmSourceFile const* sf : sourceFiles) {
1685 // We only need source group members that are part of this target.
1686 auto si = sources.Index.find(sf);
1687 if (si == sources.Index.end()) {
1688 continue;
1689 }
1690
1691 std::string source = sf->GetFullPath();
1692
1693 if (source != libName || target->GetType() == cmStateEnums::UTILITY ||
1694 target->GetType() == cmStateEnums::GLOBAL_TARGET ||
1695 target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
1696 cmGeneratorTarget::AllConfigSource const& acs =
1697 sources.Sources[si->second];
1698
1699 FCInfo fcinfo(this, target, acs, configs);
1700
1701 fout << "\t\t\t<File\n";
1702 std::string d = this->ConvertToXMLOutputPathSingle(source);
1703 // Tell MS-Dev what the source is. If the compiler knows how to
1704 // build it, then it will.
1705 fout << "\t\t\t\tRelativePath=\"" << d << "\">\n";
1706 if (cmCustomCommand const* command = sf->GetCustomCommand()) {

Callers 1

WriteVCProjFileMethod · 0.95

Calls 15

WriteVCProjBeginGroupMethod · 0.95
WriteCustomRuleMethod · 0.95
WriteVCProjEndGroupMethod · 0.95
GetSourceFilesMethod · 0.80
c_strMethod · 0.80
GetCustomCommandMethod · 0.80
GetLanguageMethod · 0.80
GetExtensionMethod · 0.80
IsMarmasmEnabledMethod · 0.80
IsMasmEnabledMethod · 0.80
AddDefinesMethod · 0.80

Tested by

no test coverage detected