Merge topic 'eclipse-resource-encoding'

09c1991895 Eclipse: Add option to set the resource encoding

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3525
This commit is contained in:
Brad King
2019-07-11 12:49:25 +00:00
committed by Kitware Robot
6 changed files with 40 additions and 0 deletions
+1
View File
@@ -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
+1
View File
@@ -158,6 +158,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
@@ -0,0 +1,6 @@
eclipse-resource-encoding
-------------------------
* The :generator:`Eclipse CDT4` extra generator gained a new
:variable:`CMAKE_ECLIPSE_RESOURCE_ENCODING` option to specify
the resource encoding.
@@ -0,0 +1,6 @@
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.
+23
View File
@@ -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()
+3
View File
@@ -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();