diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index cd1407df627874a963fce0120020c1c7eb2b4e37..5552fa98f786faf5f8a8cae212436d56c03efa83 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -747,11 +747,10 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement()
 
   cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator();
 
-  int commandLineLengthLimit = -1;
-  if (!this->ForceResponseFile()) {
-    commandLineLengthLimit = calculateCommandLineLengthLimit(
-      globalGen.GetRuleCmdLength(this->LanguageLinkerDeviceRule()));
-  }
+  // Device linking currently doesn't support response files so
+  // do not check if the user has explicitly forced a response file.
+  int const commandLineLengthLimit = calculateCommandLineLengthLimit(
+    globalGen.GetRuleCmdLength(this->LanguageLinkerDeviceRule()));
 
   const std::string rspfile =
     std::string(cmake::GetCMakeFilesDirectoryPostSlash()) +
@@ -1033,8 +1032,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
   }
   cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator();
 
+  bool const lang_supports_response =
+    !(this->TargetLinkLanguage == "RC" || this->TargetLinkLanguage == "CUDA");
   int commandLineLengthLimit = -1;
-  if (!this->ForceResponseFile()) {
+  if (!lang_supports_response || !this->ForceResponseFile()) {
     commandLineLengthLimit = calculateCommandLineLengthLimit(
       globalGen.GetRuleCmdLength(this->LanguageLinkerRule()));
   }
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 5866950dae60b6129c2c7e96d42372a95e477647..e233f1266653194f40ea57918178bd8208d67630 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -410,7 +410,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
   std::string rspcontent;
   std::string responseFlag;
 
-  if (lang != "RC" && this->ForceResponseFile()) {
+  bool const lang_supports_response = !(lang == "RC" || lang == "CUDA");
+  if (lang_supports_response && this->ForceResponseFile()) {
     rspfile = "$RSP_FILE";
     responseFlag = "@" + rspfile;
     rspcontent = " $DEFINES $INCLUDES $FLAGS";
@@ -935,9 +936,10 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
 
   this->SetMsvcTargetPdbVariable(vars);
 
-  bool const isRC = (language == "RC");
+  bool const lang_supports_response =
+    !(language == "RC" || language == "CUDA");
   int const commandLineLengthLimit =
-    ((!isRC && this->ForceResponseFile())) ? -1 : 0;
+    ((lang_supports_response && this->ForceResponseFile())) ? -1 : 0;
   std::string const rspfile = objectFileName + ".rsp";
 
   this->GetGlobalGenerator()->WriteBuild(