1
0
Эх сурвалжийг харах

Merge topic 'mingw32-make-backslash-workaround'

bb6663ca Makefile: Workaround mingw32-make trailing backslash trouble (#15546)
Brad King 10 жил өмнө
parent
commit
8403c8da2c

+ 1 - 0
Source/cmLocalUnixMakefileGenerator3.h

@@ -95,6 +95,7 @@ public:
    * Set to true if the make tool being used is MinGW Make.
    * Set to true if the make tool being used is MinGW Make.
    */
    */
   void SetMinGWMake(bool v)  {this->MinGWMake = v;}
   void SetMinGWMake(bool v)  {this->MinGWMake = v;}
+  bool IsMinGWMake() const { return this->MinGWMake; }
 
 
   /**
   /**
    * Set to true if the make tool being used is NMake.
    * Set to true if the make tool being used is NMake.

+ 10 - 0
Source/cmMakefileTargetGenerator.cxx

@@ -24,6 +24,7 @@
 #include "cmComputeLinkInformation.h"
 #include "cmComputeLinkInformation.h"
 #include "cmCustomCommandGenerator.h"
 #include "cmCustomCommandGenerator.h"
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorExpression.h"
+#include "cmAlgorithms.h"
 
 
 #include "cmMakefileExecutableTargetGenerator.h"
 #include "cmMakefileExecutableTargetGenerator.h"
 #include "cmMakefileLibraryTargetGenerator.h"
 #include "cmMakefileLibraryTargetGenerator.h"
@@ -681,6 +682,15 @@ cmMakefileTargetGenerator
     this->Convert(targetFullPathCompilePDB,
     this->Convert(targetFullPathCompilePDB,
                   cmLocalGenerator::START_OUTPUT,
                   cmLocalGenerator::START_OUTPUT,
                   cmLocalGenerator::SHELL);
                   cmLocalGenerator::SHELL);
+
+  if (this->LocalGenerator->IsMinGWMake() &&
+      cmHasLiteralSuffix(targetOutPathCompilePDB, "\\"))
+    {
+    // mingw32-make incorrectly interprets 'a\ b c' as 'a b' and 'c'
+    // (but 'a\ b "c"' as 'a\', 'b', and 'c'!).  Workaround this by
+    // avoiding a trailing backslash in the argument.
+    targetOutPathCompilePDB[targetOutPathCompilePDB.size()-1] = '/';
+    }
   }
   }
   cmLocalGenerator::RuleVariables vars;
   cmLocalGenerator::RuleVariables vars;
   vars.RuleLauncher = "RULE_LAUNCH_COMPILE";
   vars.RuleLauncher = "RULE_LAUNCH_COMPILE";