summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalNinjaGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-10-21 12:59:42 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2016-10-21 12:59:42 (GMT)
commit1e555a44aa4e3d40bca2f88915c9f957098e5a55 (patch)
tree9d640540347dd4cbaa8b80824b8a69e5b0f721e0 /Source/cmGlobalNinjaGenerator.cxx
parentdd7f9d8393b4dfd470335e662bfb94aaf57f93e1 (diff)
parentced77d2bbd07d195f563217bea1930e29472fd4d (diff)
downloadCMake-1e555a44aa4e3d40bca2f88915c9f957098e5a55.zip
CMake-1e555a44aa4e3d40bca2f88915c9f957098e5a55.tar.gz
CMake-1e555a44aa4e3d40bca2f88915c9f957098e5a55.tar.bz2
Merge topic 'ninja-encoding'
ced77d2b Ninja: Use ANSI encoding for Ninja build files on Windows
Diffstat (limited to 'Source/cmGlobalNinjaGenerator.cxx')
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx18
1 files changed, 16 insertions, 2 deletions
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index f023a2a..182d7e4 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -496,6 +496,18 @@ cmLocalGenerator* cmGlobalNinjaGenerator::CreateLocalGenerator(cmMakefile* mf)
return new cmLocalNinjaGenerator(this, mf);
}
+codecvt::Encoding cmGlobalNinjaGenerator::GetMakefileEncoding() const
+{
+#ifdef _WIN32
+ // Ninja on Windows does not support non-ANSI characters.
+ // https://github.com/ninja-build/ninja/issues/1195
+ return codecvt::ANSI;
+#else
+ // No encoding conversion needed on other platforms.
+ return codecvt::None;
+#endif
+}
+
void cmGlobalNinjaGenerator::GetDocumentation(cmDocumentationEntry& entry)
{
entry.Name = cmGlobalNinjaGenerator::GetActualName();
@@ -766,7 +778,8 @@ void cmGlobalNinjaGenerator::OpenBuildFileStream()
// Get a stream where to generate things.
if (!this->BuildFileStream) {
- this->BuildFileStream = new cmGeneratedFileStream(buildFilePath.c_str());
+ this->BuildFileStream = new cmGeneratedFileStream(
+ buildFilePath.c_str(), false, this->GetMakefileEncoding());
if (!this->BuildFileStream) {
// An error message is generated by the constructor if it cannot
// open the file.
@@ -803,7 +816,8 @@ void cmGlobalNinjaGenerator::OpenRulesFileStream()
// Get a stream where to generate things.
if (!this->RulesFileStream) {
- this->RulesFileStream = new cmGeneratedFileStream(rulesFilePath.c_str());
+ this->RulesFileStream = new cmGeneratedFileStream(
+ rulesFilePath.c_str(), false, this->GetMakefileEncoding());
if (!this->RulesFileStream) {
// An error message is generated by the constructor if it cannot
// open the file.