瀏覽代碼

BUG: Work-around Watcom WMake limitation for multiple-output custom command support.

Brad King 19 年之前
父節點
當前提交
b323c3f51c

+ 9 - 0
Source/cmGlobalUnixMakefileGenerator3.h

@@ -110,6 +110,9 @@ public:
       check-build-system step.  */
   virtual void CheckMultipleOutputs(cmMakefile* mf, bool verbose);
 
+  /** Get the command to use for a non-symbolic target file that has
+      no rule.  This is used for multiple output dependencies.  */
+  std::string GetEmptyCommandHack() { return this->EmptyCommandsHack; }
 protected:
   void WriteMainMakefile2();
   void WriteMainCMakefile();
@@ -151,6 +154,12 @@ protected:
   // that can be added.
   std::string EmptyRuleHackDepends;
 
+  // Some make programs (Watcom) do not like rules with no commands
+  // for non-symbolic targets.  If non-empty this variable holds a
+  // bogus command that may be put in the rule to satisfy the make
+  // program.
+  std::string EmptyCommandsHack;
+
   typedef std::map<cmStdString, cmStdString> MultipleOutputPairsType;
   MultipleOutputPairsType MultipleOutputPairs;
 };

+ 1 - 0
Source/cmGlobalWatcomWMakeGenerator.cxx

@@ -23,6 +23,7 @@ cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator()
   this->FindMakeProgramFile = "CMakeFindWMake.cmake";
   this->ForceUnixPaths = false;
   this->ToolSupportsColorVT100 = false;
+  this->EmptyCommandsHack = "@cd .";
 }
 
 void cmGlobalWatcomWMakeGenerator::EnableLanguage(std::vector<std::string>const& l,

+ 5 - 0
Source/cmMakefileTargetGenerator.cxx

@@ -660,6 +660,11 @@ void cmMakefileTargetGenerator
   commands.clear();
   cmGlobalUnixMakefileGenerator3* gg =
     static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
+  std::string emptyCommand = gg->GetEmptyCommandHack();
+  if(!emptyCommand.empty())
+    {
+    commands.push_back(emptyCommand);
+    }
   for(++o; o != outputs.end(); ++o)
     {
     this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,