mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 13:51:33 -06:00
NMake: Use UTF-8 BOM in response files only with MSVC tooling
Since commit f3f57cc4ed (NMake: Use UTF-8 with BOM if supported by
nmake, 2021-04-22, v3.21.0-rc1~217^2), we add a BOM to response files
to tell MSVC tooling that they are encoded as UTF-8. However, the
"NMake Makefiles" generator may also be used with non-MSVC toolchains
that do not understand the BOM. Update the response file encoding
selection heuristic to add the BOM only with MSVC tooling.
Fixes: #23143
This commit is contained in:
@@ -2053,6 +2053,11 @@ std::string cmMakefileTargetGenerator::CreateResponseFile(
|
||||
// For now, use the makefile encoding as a heuristic.
|
||||
codecvt::Encoding responseEncoding =
|
||||
this->GlobalGenerator->GetMakefileEncoding();
|
||||
// Non-MSVC tooling may not understand a BOM.
|
||||
if (responseEncoding == codecvt::UTF8_WITH_BOM &&
|
||||
!this->Makefile->IsOn("MSVC")) {
|
||||
responseEncoding = codecvt::UTF8;
|
||||
}
|
||||
|
||||
// Create the response file.
|
||||
std::string responseFileNameFull =
|
||||
|
||||
Reference in New Issue
Block a user