diff options
author | Martin Gerhardy <martin.gerhardy@gmail.com> | 2019-07-08 08:57:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-07-09 17:34:29 (GMT) |
commit | 09c1991895baf0eeca028672a6730f2101d3b2b7 (patch) | |
tree | 35ee8546603f9b1803279f040a950dbb5d410f53 /Source | |
parent | 5f2f16319ab5832da4b3c7b0c1a5a4587a3991eb (diff) | |
download | CMake-09c1991895baf0eeca028672a6730f2101d3b2b7.zip CMake-09c1991895baf0eeca028672a6730f2101d3b2b7.tar.gz CMake-09c1991895baf0eeca028672a6730f2101d3b2b7.tar.bz2 |
Eclipse: Add option to set the resource encoding
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmExtraEclipseCDT4Generator.cxx | 23 | ||||
-rw-r--r-- | Source/cmExtraEclipseCDT4Generator.h | 3 |
2 files changed, 26 insertions, 0 deletions
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index aece3bc..73984a8 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -164,6 +164,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() diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h index 5136660..ef038d9 100644 --- a/Source/cmExtraEclipseCDT4Generator.h +++ b/Source/cmExtraEclipseCDT4Generator.h @@ -43,6 +43,9 @@ private: // create .project file in the source tree void CreateSourceProjectFile(); + // create .settings/org.eclipse.core.resources.prefs + void CreateSettingsResourcePrefsFile(); + // create .project file void CreateProjectFile(); |