Ver Fonte

Merge topic 'eclipse-custom-content'

fd0da95f63 Eclipse: Add property to include additional contents in .cproject file

Acked-by: Kitware Robot <[email protected]>
Merge-request: !2088
Brad King há 7 anos atrás
pai
commit
64ec064212

+ 1 - 0
Help/manual/cmake-properties.7.rst

@@ -40,6 +40,7 @@ Properties of Global Scope
    /prop_gbl/JOB_POOLS
    /prop_gbl/JOB_POOLS
    /prop_gbl/PREDEFINED_TARGETS_FOLDER
    /prop_gbl/PREDEFINED_TARGETS_FOLDER
    /prop_gbl/ECLIPSE_EXTRA_NATURES
    /prop_gbl/ECLIPSE_EXTRA_NATURES
+   /prop_gbl/ECLIPSE_EXTRA_CPROJECT_CONTENTS
    /prop_gbl/REPORT_UNDEFINED_PROPERTIES
    /prop_gbl/REPORT_UNDEFINED_PROPERTIES
    /prop_gbl/RULE_LAUNCH_COMPILE
    /prop_gbl/RULE_LAUNCH_COMPILE
    /prop_gbl/RULE_LAUNCH_CUSTOM
    /prop_gbl/RULE_LAUNCH_CUSTOM

+ 12 - 0
Help/prop_gbl/ECLIPSE_EXTRA_CPROJECT_CONTENTS.rst

@@ -0,0 +1,12 @@
+ECLIPSE_EXTRA_CPROJECT_CONTENTS
+-------------------------------
+
+Additional contents to be inserted into the generated Eclipse cproject file.
+
+The cproject file defines the CDT specific information. Some third party IDE's
+are based on Eclipse with the addition of other information specific to that IDE.
+Through this property, it is possible to add this additional contents to
+the generated project.
+It is expected to contain valid XML.
+
+Also see the :prop_gbl:`ECLIPSE_EXTRA_NATURES` property.

+ 2 - 0
Help/prop_gbl/ECLIPSE_EXTRA_NATURES.rst

@@ -6,3 +6,5 @@ List of natures to add to the generated Eclipse project file.
 Eclipse projects specify language plugins by using natures. This property
 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
 should be set to the unique identifier for a nature (which looks like a Java
 package name).
 package name).
+
+Also see the :prop_gbl:`ECLIPSE_EXTRA_CPROJECT_CONTENTS` property.

+ 7 - 0
Source/cmExtraEclipseCDT4Generator.cxx

@@ -1001,6 +1001,13 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
   xml.EndElement(); // project
   xml.EndElement(); // project
 
 
   xml.EndElement(); // storageModule
   xml.EndElement(); // storageModule
+
+  // Append additional cproject contents without applying any XML formatting
+  if (const char* extraCProjectContents =
+        mf->GetState()->GetGlobalProperty("ECLIPSE_EXTRA_CPROJECT_CONTENTS")) {
+    fout << extraCProjectContents;
+  }
+
   xml.EndElement(); // cproject
   xml.EndElement(); // cproject
 }
 }