summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorRobert Maynard <rmaynard@nvidia.com>2023-02-27 21:01:18 (GMT)
committerRobert Maynard <rmaynard@nvidia.com>2023-02-28 20:39:55 (GMT)
commitc5305cf493a442f0a3fdc2f987343db48d9e3330 (patch)
tree5e7be30c40d263b641a478bbba86d0d85e136ee4 /Source/cmMakefileTargetGenerator.cxx
parent157e361ff7aae3f20b2d71229182d304ea792f05 (diff)
downloadCMake-c5305cf493a442f0a3fdc2f987343db48d9e3330.zip
CMake-c5305cf493a442f0a3fdc2f987343db48d9e3330.tar.gz
CMake-c5305cf493a442f0a3fdc2f987343db48d9e3330.tar.bz2
Makefile: Don't pass the CUDA compiler response files with UTF8_BOM
Fixes #24544
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx22
1 files changed, 12 insertions, 10 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 2b817c3..e217dd9 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -2176,16 +2176,16 @@ bool cmMakefileTargetGenerator::CheckUseResponseFileForLibraries(
std::string cmMakefileTargetGenerator::CreateResponseFile(
const std::string& name, std::string const& options,
- std::vector<std::string>& makefile_depends)
+ std::vector<std::string>& makefile_depends, std::string const& language)
{
// FIXME: Find a better way to determine the response file encoding,
// perhaps using tool-specific platform information variables.
// For now, use the makefile encoding as a heuristic.
codecvt::Encoding responseEncoding =
this->GlobalGenerator->GetMakefileEncoding();
- // Non-MSVC tooling may not understand a BOM.
+ // Non-MSVC tooling doesn't understand BOM encoded files.
if (responseEncoding == codecvt::UTF8_WITH_BOM &&
- !this->Makefile->IsOn("MSVC")) {
+ (language == "CUDA" || !this->Makefile->IsOn("MSVC"))) {
responseEncoding = codecvt::UTF8;
}
@@ -2222,7 +2222,7 @@ cmMakefileTargetGenerator::CreateLinkLineComputer(
void cmMakefileTargetGenerator::CreateLinkLibs(
cmLinkLineComputer* linkLineComputer, std::string& linkLibs,
bool useResponseFile, std::vector<std::string>& makefile_depends,
- ResponseFlagFor responseMode)
+ std::string const& linkLanguage, ResponseFlagFor responseMode)
{
std::string frameworkPath;
std::string linkPath;
@@ -2240,8 +2240,9 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
// Create this response file.
std::string responseFileName =
(responseMode == Link) ? "linkLibs.rsp" : "deviceLinkLibs.rsp";
- std::string link_rsp =
- this->CreateResponseFile(responseFileName, linkLibs, makefile_depends);
+ std::string responseLang = (responseMode == Link) ? linkLanguage : "CUDA";
+ std::string link_rsp = this->CreateResponseFile(
+ responseFileName, linkLibs, makefile_depends, responseLang);
// Reference the response file.
linkLibs = cmStrCat(responseFlag,
@@ -2253,7 +2254,8 @@ void cmMakefileTargetGenerator::CreateLinkLibs(
void cmMakefileTargetGenerator::CreateObjectLists(
bool useLinkScript, bool useArchiveRules, bool useResponseFile,
std::string& buildObjs, std::vector<std::string>& makefile_depends,
- bool useWatcomQuote, ResponseFlagFor responseMode)
+ bool useWatcomQuote, std::string const& linkLanguage,
+ ResponseFlagFor responseMode)
{
std::string variableName;
std::string variableNameExternal;
@@ -2282,7 +2284,7 @@ void cmMakefileTargetGenerator::CreateObjectLists(
// Create this response file.
std::string objects_rsp = this->CreateResponseFile(
- responseFileName, object_strings[i], makefile_depends);
+ responseFileName, object_strings[i], makefile_depends, linkLanguage);
// Separate from previous response file references.
buildObjs += sep;
@@ -2334,8 +2336,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
}
std::string name = cmStrCat("includes_", lang, ".rsp");
std::string arg = std::move(responseFlag) +
- this->CreateResponseFile(name, includeFlags,
- this->FlagFileDepends[lang]);
+ this->CreateResponseFile(name, includeFlags, this->FlagFileDepends[lang],
+ lang);
this->LocalGenerator->AppendFlags(flags, arg);
} else {
this->LocalGenerator->AppendFlags(flags, includeFlags);