summaryrefslogtreecommitdiffstats
path: root/Source/cmExtraEclipseCDT4Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-11 12:49:25 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-07-11 12:49:34 (GMT)
commit01a8b89f292c031e7a35bedf92b7cda98bef7f6d (patch)
tree9fe512dc950ca862990d5907156de9cae808d965 /Source/cmExtraEclipseCDT4Generator.cxx
parent24722b7860ebab15baaf124b84378d323494813e (diff)
parent09c1991895baf0eeca028672a6730f2101d3b2b7 (diff)
downloadCMake-01a8b89f292c031e7a35bedf92b7cda98bef7f6d.zip
CMake-01a8b89f292c031e7a35bedf92b7cda98bef7f6d.tar.gz
CMake-01a8b89f292c031e7a35bedf92b7cda98bef7f6d.tar.bz2
Merge topic 'eclipse-resource-encoding'
09c1991895 Eclipse: Add option to set the resource encoding Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3525
Diffstat (limited to 'Source/cmExtraEclipseCDT4Generator.cxx')
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index d6f7021..06709f1 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -166,6 +166,29 @@ void cmExtraEclipseCDT4Generator::Generate()
// create a .cproject file
this->CreateCProjectFile();
+
+ // create resource settings
+ this->CreateSettingsResourcePrefsFile();
+}
+
+void cmExtraEclipseCDT4Generator::CreateSettingsResourcePrefsFile()
+{
+ cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
+ cmMakefile* mf = lg->GetMakefile();
+
+ const std::string filename =
+ this->HomeOutputDirectory + "/.settings/org.eclipse.core.resources.prefs";
+
+ cmGeneratedFileStream fout(filename);
+ if (!fout) {
+ return;
+ }
+
+ fout << "eclipse.preferences.version=1" << std::endl;
+ const char* encoding = mf->GetDefinition("CMAKE_ECLIPSE_RESOURCE_ENCODING");
+ if (encoding) {
+ fout << "encoding/<project>=" << encoding << std::endl;
+ }
}
void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()