diff options
author | Brad King <brad.king@kitware.com> | 2022-01-26 12:24:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-01-26 12:57:43 (GMT) |
commit | d5ee6d50ee71f78dc619001e86e69f23444acfa9 (patch) | |
tree | 1f63ada9b70bd6403c1f26123c861596702c5daa /Source/cmMakefileTargetGenerator.cxx | |
parent | cab631c2e242ff74a1bddd973b5aafe9b6f4ebd5 (diff) | |
download | CMake-d5ee6d50ee71f78dc619001e86e69f23444acfa9.zip CMake-d5ee6d50ee71f78dc619001e86e69f23444acfa9.tar.gz CMake-d5ee6d50ee71f78dc619001e86e69f23444acfa9.tar.bz2 |
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
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index add9c01..9458277 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -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 = |