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

Method CreateCProjectFile

Source/cmExtraEclipseCDT4Generator.cxx:608–1047  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
609{
610 std::set<std::string> emitted;
611
612 auto const& lg = this->GlobalGenerator->GetLocalGenerators()[0];
613 cmMakefile const* mf = lg->GetMakefile();
614
615 std::string const filename = this->HomeOutputDirectory + "/.cproject";
616
617 cmGeneratedFileStream fout(filename);
618 if (!fout) {
619 return;
620 }
621
622 cmXMLWriter xml(fout);
623
624 // add header
625 xml.StartDocument("UTF-8");
626 xml.ProcessingInstruction("fileVersion", "4.0.0");
627 xml.StartElement("cproject");
628 xml.StartElement("storageModule");
629 xml.Attribute("moduleId", "org.eclipse.cdt.core.settings");
630
631 xml.StartElement("cconfiguration"); // noqa: spellcheck disable-line
632 xml.Attribute("id", "org.eclipse.cdt.core.default.config.1");
633
634 // Configuration settings...
635 xml.StartElement("storageModule");
636 xml.Attribute("buildSystemId",
637 "org.eclipse.cdt.core.defaultConfigDataProvider");
638 xml.Attribute("id", "org.eclipse.cdt.core.default.config.1");
639 xml.Attribute("moduleId", "org.eclipse.cdt.core.settings");
640 xml.Attribute("name", "Configuration");
641 xml.Element("externalSettings");
642 xml.StartElement("extensions");
643
644 // TODO: refactor this out...
645 std::string executableFormat =
646 mf->GetSafeDefinition("CMAKE_EXECUTABLE_FORMAT");
647 if (executableFormat == "ELF") {
648 xml.StartElement("extension");
649 xml.Attribute("id", "org.eclipse.cdt.core.ELF");
650 xml.Attribute("point", "org.eclipse.cdt.core.BinaryParser");
651 xml.EndElement(); // extension
652
653 xml.StartElement("extension");
654 xml.Attribute("id", "org.eclipse.cdt.core.GNU_ELF");
655 xml.Attribute("point", "org.eclipse.cdt.core.BinaryParser");
656 AppendAttribute(xml, "addr2line");
657 AppendAttribute(xml, "c++filt");
658 xml.EndElement(); // extension
659 } else {
660 std::string systemName = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME");
661 if (systemName == "CYGWIN" || systemName == "MSYS") {
662 xml.StartElement("extension");
663 xml.Attribute("id", "org.eclipse.cdt.core.Cygwin_PE");
664 xml.Attribute("point", "org.eclipse.cdt.core.BinaryParser");
665 AppendAttribute(xml, "addr2line");

Callers 1

GenerateMethod · 0.95

Calls 15

AppendAttributeFunction · 0.85
moveFunction · 0.85
cmHasLiteralPrefixFunction · 0.85
StartDocumentMethod · 0.80
ProcessingInstructionMethod · 0.80
AttributeMethod · 0.80
lengthMethod · 0.80
c_strMethod · 0.80
GetGlobalPropertyMethod · 0.80
cmStrCatFunction · 0.70

Tested by

no test coverage detected