Commit 09c19918 authored by Martin Gerhardy's avatar Martin Gerhardy Committed by Brad King

Eclipse: Add option to set the resource encoding

parent 5f2f1631
......@@ -915,6 +915,7 @@ syn keyword cmakeVariable contained
\ CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES
\ CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT
\ CMAKE_ECLIPSE_MAKE_ARGUMENTS
\ CMAKE_ECLIPSE_RESOURCE_ENCODING
\ CMAKE_ECLIPSE_VERSION
\ CMAKE_EDIT_COMMAND
\ CMAKE_ENABLE_EXPORTS
......
......@@ -157,6 +157,7 @@ Variables that Change Behavior
/variable/CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES
/variable/CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT
/variable/CMAKE_ECLIPSE_MAKE_ARGUMENTS
/variable/CMAKE_ECLIPSE_RESOURCE_ENCODING
/variable/CMAKE_ECLIPSE_VERSION
/variable/CMAKE_ERROR_DEPRECATED
/variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
......
eclipse-resource-encoding
-------------------------
* The :generator:`Eclipse CDT4` extra generator gained a new
:variable:`CMAKE_ECLIPSE_RESOURCE_ENCODING` option to specify
the resource encoding.
CMAKE_ECLIPSE_RESOURCE_ENCODING
-------------------------------
This cache variable tells the :generator:`Eclipse CDT4` project generator
to set the resource encoding to the given value in generated project files.
If no value is given, no encoding will be set.
......@@ -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()
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment