diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2021-02-26 16:49:50 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2021-03-09 16:09:24 (GMT) |
commit | 9af6e2e7b2940d5ba4d138f0df5950a675ec41c0 (patch) | |
tree | ed6741d332a8c57fe1d1dab37292a842b516cedd /Source/cmLocalNinjaGenerator.cxx | |
parent | 4250c5f91b67a84318c31485a2ab36ab64967f21 (diff) | |
download | CMake-9af6e2e7b2940d5ba4d138f0df5950a675ec41c0.zip CMake-9af6e2e7b2940d5ba4d138f0df5950a675ec41c0.tar.gz CMake-9af6e2e7b2940d5ba4d138f0df5950a675ec41c0.tar.bz2 |
Ninja: Use new wincodepage tool to determine encoding
Ninja 1.11 and later uses UTF-8 on Windows when possible, and
includes a tool that reports the code page in use. Use this tool
to determine what encoding to write the Ninja files in.
Fixes: #21866
Diffstat (limited to 'Source/cmLocalNinjaGenerator.cxx')
-rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 8ed411a..050c907 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -97,9 +97,12 @@ void cmLocalNinjaGenerator::Generate() // contains any non-ASCII characters and dependency checking will fail. // As a workaround, leave the msvc_deps_prefix UTF-8 encoded even though // the rest of the file is ANSI encoded. - if (GetConsoleOutputCP() == CP_UTF8 && GetACP() != CP_UTF8) { + if (GetConsoleOutputCP() == CP_UTF8 && GetACP() != CP_UTF8 && + this->GetGlobalGenerator()->GetMakefileEncoding() != codecvt::None) { this->GetRulesFileStream().WriteRaw(showIncludesPrefix); } else { + // Ninja 1.11 and above uses the UTF-8 code page if it's supported, so + // in that case we can write it normally without using raw bytes. this->GetRulesFileStream() << showIncludesPrefix; } #else |