diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 676d4ed62a..effc38cf0d 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -50,6 +50,29 @@ void cmExtraEclipseCDT4Generator entry.Brief = "Generates Eclipse CDT 4.0 project files."; } +//---------------------------------------------------------------------------- +void cmExtraEclipseCDT4Generator +::EnableLanguage(std::vector const& languages, + cmMakefile *, bool) +{ + for (std::vector::const_iterator lit = languages.begin(); + lit != languages.end(); ++lit) + { + if (*lit == "CXX") + { + this->Natures.insert("org.eclipse.cdt.core.ccnature"); + } + else if (*lit == "C") + { + this->Natures.insert("org.eclipse.cdt.core.cnature"); + } + else if (*lit == "Java") + { + this->Natures.insert("org.eclipse.jdt.core.javanature"); + } + } +} + //---------------------------------------------------------------------------- void cmExtraEclipseCDT4Generator::Generate() { @@ -433,13 +456,16 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile() // set natures for c/c++ projects fout << "\t\n" - // TODO: ccnature only if it is c++ ??? - "\t\torg.eclipse.cdt.core.ccnature\n" "\t\torg.eclipse.cdt.make.core.makeNature\n" - "\t\torg.eclipse.cdt.make.core.ScannerConfigNature\n" - "\t\torg.eclipse.cdt.core.cnature\n" - "\t\n" - ; + "\t\torg.eclipse.cdt.make.core.ScannerConfigNature\n"; + + for (std::set::const_iterator nit=this->Natures.begin(); + nit != this->Natures.end(); ++nit) + { + fout << "\t\t" << *nit << "\n"; + } + + fout << "\t\n"; fout << "\t\n"; // create linked resources diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index b31cce74c5..9c89f85158 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -41,6 +41,8 @@ public: virtual void GetDocumentation(cmDocumentationEntry& entry, const char* fullName) const; + virtual void EnableLanguage(std::vector const& languages, + cmMakefile *, bool optional); virtual void Generate(); @@ -105,6 +107,7 @@ private: void CreateLinksForTargets(cmGeneratedFileStream& fout); std::vector SrcLinkedResources; + std::set Natures; std::string HomeDirectory; std::string HomeOutputDirectory; bool IsOutOfSourceBuild;