eclipse: Support custom natures via a global property

This is useful for enabling natures not recognized by the Eclipse
generator directly in a project.
This commit is contained in:
Ben Boeckel 2013-08-29 14:51:59 -04:00
parent 51726cce64
commit a990722b5a
3 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -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).

View File

@ -465,6 +465,18 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
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";