diff options
-rw-r--r-- | Auxiliary/vim/syntax/cmake.vim | 1 | ||||
-rw-r--r-- | Help/manual/cmake-variables.7.rst | 1 | ||||
-rw-r--r-- | Help/release/dev/eclipse-resource-encoding.rst | 6 | ||||
-rw-r--r-- | Help/variable/CMAKE_ECLIPSE_RESOURCE_ENCODING.rst | 6 | ||||
-rw-r--r-- | Source/cmExtraEclipseCDT4Generator.cxx | 23 | ||||
-rw-r--r-- | Source/cmExtraEclipseCDT4Generator.h | 3 |
6 files changed, 40 insertions, 0 deletions
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index cd8385b..69e199f 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -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 diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index cc6a7d2..b9f17d0 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -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 diff --git a/Help/release/dev/eclipse-resource-encoding.rst b/Help/release/dev/eclipse-resource-encoding.rst new file mode 100644 index 0000000..6ceca0c --- /dev/null +++ b/Help/release/dev/eclipse-resource-encoding.rst @@ -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. diff --git a/Help/variable/CMAKE_ECLIPSE_RESOURCE_ENCODING.rst b/Help/variable/CMAKE_ECLIPSE_RESOURCE_ENCODING.rst new file mode 100644 index 0000000..314efe5 --- /dev/null +++ b/Help/variable/CMAKE_ECLIPSE_RESOURCE_ENCODING.rst @@ -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. 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(); |