summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2014-03-14 14:48:42 (GMT)
committerClinton Stimpson <clinton@elemtech.com>2014-03-14 14:48:42 (GMT)
commitee8cef8725486519a7ab47eb16208d4d64e0ab99 (patch)
treebc967cae43b43a6fa756349622a34152dcd6e0b3
parent91fd99b86532dbf35d8c7396654b9beac058c8f3 (diff)
downloadCMake-ee8cef8725486519a7ab47eb16208d4d64e0ab99.zip
CMake-ee8cef8725486519a7ab47eb16208d4d64e0ab99.tar.gz
CMake-ee8cef8725486519a7ab47eb16208d4d64e0ab99.tar.bz2
Encoding: If configured, write Visual Studio project files as UTF-8.
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx14
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h3
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx3
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx12
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx6
5 files changed, 30 insertions, 8 deletions
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 320b440..42033c5 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -873,7 +873,8 @@ cmGlobalVisualStudio7Generator::WriteUtilityDepend(cmTarget const* target)
std::string guid = this->GetGUID(pname.c_str());
fout <<
- "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"
+ "<?xml version=\"1.0\" encoding = \""
+ << this->Encoding() << "\"?>\n"
"<VisualStudioProject\n"
"\tProjectType=\"Visual C++\"\n"
"\tVersion=\"" << this->GetIDEVersion() << "0\"\n"
@@ -1038,3 +1039,14 @@ cmIDEFlagTable const* cmGlobalVisualStudio7Generator::GetExtraFlagTableVS7()
{
return cmVS7ExtraFlagTable;
}
+
+std::string cmGlobalVisualStudio7Generator::Encoding()
+{
+ std::ostringstream encoding;
+#ifdef CMAKE_ENCODING_UTF8
+ encoding << "UTF-8";
+#else
+ encoding << "Windows-1252";
+#endif
+ return encoding.str();
+}
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 0d2e410..1dc709d 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -109,6 +109,9 @@ public:
virtual void FindMakeProgram(cmMakefile*);
+ // Encoding for Visual Studio files
+ virtual std::string Encoding();
+
protected:
virtual const char* GetIDEVersion() { return "7.0"; }
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 69c893c..2b2a471 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -1,3 +1,4 @@
+
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
@@ -918,4 +919,4 @@ std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir(
i += config.size();
}
return tmp;
-}
+} \ No newline at end of file
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 14ad567..52524aa 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1975,7 +1975,8 @@ cmLocalVisualStudio7Generator
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
- fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"
+ fout << "<?xml version=\"1.0\" encoding = \""
+ << gg->Encoding() << "\"?>\n"
<< "<VisualStudioProject\n"
<< "\tProjectCreator=\"Intel Fortran\"\n"
<< "\tVersion=\"" << gg->GetIntelProjectVersion() << "\"\n";
@@ -2038,7 +2039,12 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
this->WriteProjectStartFortran(fout, libName, target);
return;
}
- fout << "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n"
+
+ cmGlobalVisualStudio7Generator* gg =
+ static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
+
+ fout << "<?xml version=\"1.0\" encoding = \""
+ << gg->Encoding() << "\"?>\n"
<< "<VisualStudioProject\n"
<< "\tProjectType=\"Visual C++\"\n";
if(this->Version == VS71)
@@ -2059,8 +2065,6 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout,
{
keyword = "Win32Proj";
}
- cmGlobalVisualStudio7Generator* gg =
- static_cast<cmGlobalVisualStudio7Generator *>(this->GlobalGenerator);
fout << "\tName=\"" << projLabel << "\"\n";
if(this->Version >= VS8)
{
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 7c55f64..8e8968d 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -222,7 +222,8 @@ void cmVisualStudio10TargetGenerator::Generate()
//get the tools version to use
const std::string toolsVer(this->GlobalGenerator->GetToolsVersion());
std::string project_defaults=
- "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n";
+ "<?xml version=\"1.0\" encoding=\"" +
+ this->GlobalGenerator->Encoding() + "\"?>\n";
project_defaults.append("<Project DefaultTargets=\"Build\" ToolsVersion=\"");
project_defaults.append(toolsVer +"\" ");
project_defaults.append(
@@ -732,7 +733,8 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
//get the tools version to use
const std::string toolsVer(this->GlobalGenerator->GetToolsVersion());
std::string project_defaults=
- "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>\n";
+ "<?xml version=\"1.0\" encoding=\"" +
+ this->GlobalGenerator->Encoding() + "\"?>\n";
project_defaults.append("<Project ToolsVersion=\"");
project_defaults.append(toolsVer +"\" ");
project_defaults.append(