Merge topic 'dev/better-eclipse-language-support'
a990722
eclipse: Support custom natures via a global property51726cc
eclipse: Add natures for Eclipse based on enabled languages4a352d4
Notify extra generators about languages
This commit is contained in:
commit
7df3a10a5e
|
@ -28,6 +28,7 @@ Properties of Global Scope
|
|||
/prop_gbl/PACKAGES_FOUND
|
||||
/prop_gbl/PACKAGES_NOT_FOUND
|
||||
/prop_gbl/PREDEFINED_TARGETS_FOLDER
|
||||
/prop_gbl/ECLIPSE_EXTRA_NATURES
|
||||
/prop_gbl/REPORT_UNDEFINED_PROPERTIES
|
||||
/prop_gbl/RULE_LAUNCH_COMPILE
|
||||
/prop_gbl/RULE_LAUNCH_CUSTOM
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
ECLIPSE_EXTRA_NATURES
|
||||
---------------------
|
||||
|
||||
List of natures to add to the generated Eclipse project file.
|
||||
|
||||
Eclipse projects specify language plugins by using natures. This property
|
||||
should be set to the unique identifier for a nature (which looks like a Java
|
||||
package name).
|
|
@ -13,6 +13,12 @@
|
|||
|
||||
#include "cmExternalMakefileProjectGenerator.h"
|
||||
|
||||
void cmExternalMakefileProjectGenerator
|
||||
::EnableLanguage(std::vector<std::string> const&,
|
||||
cmMakefile *, bool)
|
||||
{
|
||||
}
|
||||
|
||||
std::string cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
|
||||
const char* globalGenerator,
|
||||
const char* extraGenerator)
|
||||
|
|
|
@ -41,6 +41,8 @@ public:
|
|||
/** Get the documentation entry for this generator. */
|
||||
virtual void GetDocumentation(cmDocumentationEntry& entry,
|
||||
const char* fullName) const = 0;
|
||||
virtual void EnableLanguage(std::vector<std::string> const& languages,
|
||||
cmMakefile *, bool optional);
|
||||
|
||||
///! set the global generator which will generate the makefiles
|
||||
virtual void SetGlobalGenerator(cmGlobalGenerator* generator)
|
||||
|
|
|
@ -50,6 +50,29 @@ void cmExtraEclipseCDT4Generator
|
|||
entry.Brief = "Generates Eclipse CDT 4.0 project files.";
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmExtraEclipseCDT4Generator
|
||||
::EnableLanguage(std::vector<std::string> const& languages,
|
||||
cmMakefile *, bool)
|
||||
{
|
||||
for (std::vector<std::string>::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,28 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
|
|||
// set natures for c/c++ projects
|
||||
fout <<
|
||||
"\t<natures>\n"
|
||||
// TODO: ccnature only if it is c++ ???
|
||||
"\t\t<nature>org.eclipse.cdt.core.ccnature</nature>\n"
|
||||
"\t\t<nature>org.eclipse.cdt.make.core.makeNature</nature>\n"
|
||||
"\t\t<nature>org.eclipse.cdt.make.core.ScannerConfigNature</nature>\n"
|
||||
"\t\t<nature>org.eclipse.cdt.core.cnature</nature>\n"
|
||||
"\t</natures>\n"
|
||||
;
|
||||
"\t\t<nature>org.eclipse.cdt.make.core.ScannerConfigNature</nature>\n";
|
||||
|
||||
for (std::set<std::string>::const_iterator nit=this->Natures.begin();
|
||||
nit != this->Natures.end(); ++nit)
|
||||
{
|
||||
fout << "\t\t<nature>" << *nit << "</nature>\n";
|
||||
}
|
||||
|
||||
if (const char *extraNaturesProp = mf->GetCMakeInstance()->
|
||||
GetProperty("ECLIPSE_EXTRA_NATURES", cmProperty::GLOBAL))
|
||||
{
|
||||
std::vector<std::string> extraNatures;
|
||||
cmSystemTools::ExpandListArgument(extraNaturesProp, extraNatures);
|
||||
for (std::vector<std::string>::const_iterator nit = extraNatures.begin();
|
||||
nit != extraNatures.end(); ++nit)
|
||||
{
|
||||
fout << "\t\t<nature>" << *nit << "</nature>\n";
|
||||
}
|
||||
}
|
||||
|
||||
fout << "\t</natures>\n";
|
||||
|
||||
fout << "\t<linkedResources>\n";
|
||||
// create linked resources
|
||||
|
|
|
@ -41,6 +41,8 @@ public:
|
|||
|
||||
virtual void GetDocumentation(cmDocumentationEntry& entry,
|
||||
const char* fullName) const;
|
||||
virtual void EnableLanguage(std::vector<std::string> const& languages,
|
||||
cmMakefile *, bool optional);
|
||||
|
||||
virtual void Generate();
|
||||
|
||||
|
@ -105,6 +107,7 @@ private:
|
|||
void CreateLinksForTargets(cmGeneratedFileStream& fout);
|
||||
|
||||
std::vector<std::string> SrcLinkedResources;
|
||||
std::set<std::string> Natures;
|
||||
std::string HomeDirectory;
|
||||
std::string HomeOutputDirectory;
|
||||
bool IsOutOfSourceBuild;
|
||||
|
|
|
@ -695,6 +695,11 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
|
|||
{
|
||||
mf->ReadListFile(0,projectCompatibility.c_str());
|
||||
}
|
||||
// Inform any extra generator of the new language.
|
||||
if (this->ExtraGenerator)
|
||||
{
|
||||
this->ExtraGenerator->EnableLanguage(languages, mf, false);
|
||||
}
|
||||
|
||||
if(fatalError)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue