[cmake-commits] martink committed cmMakefileUtilityTargetGenerator.cxx 1.4 1.5 cmMakefileUtilityTargetGenerator.h 1.1 1.2

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Mar 2 14:31:06 EST 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv20600/Source

Modified Files:
	cmMakefileUtilityTargetGenerator.cxx 
	cmMakefileUtilityTargetGenerator.h 
Log Message:
BUG: fix for build order


Index: cmMakefileUtilityTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileUtilityTargetGenerator.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cmMakefileUtilityTargetGenerator.h	14 Feb 2006 15:35:59 -0000	1.1
+++ cmMakefileUtilityTargetGenerator.h	2 Mar 2007 19:31:04 -0000	1.2
@@ -23,6 +23,8 @@
   public cmMakefileTargetGenerator
 {
 public:
+  cmMakefileUtilityTargetGenerator();
+
   /* the main entry point for this class. Writes the Makefiles associated
      with this target */
   virtual void WriteRuleFiles();  

Index: cmMakefileUtilityTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileUtilityTargetGenerator.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cmMakefileUtilityTargetGenerator.cxx	14 Dec 2006 19:30:16 -0000	1.4
+++ cmMakefileUtilityTargetGenerator.cxx	2 Mar 2007 19:31:04 -0000	1.5
@@ -23,6 +23,12 @@
 #include "cmSourceFile.h"
 #include "cmTarget.h"
 
+//----------------------------------------------------------------------------
+cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator()
+{
+  this->DriveCustomCommandsOnDepends = true;
+}
+
 
 //----------------------------------------------------------------------------
 void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
@@ -42,10 +48,30 @@
   // Utility targets store their rules in pre- and post-build commands.
   this->LocalGenerator->AppendCustomDepends
     (depends, this->Target->GetPreBuildCommands());
+
+  // Build list of dependencies.
+  std::string relPath = this->LocalGenerator->GetHomeRelativeOutputPath();
+  std::string objTarget;
+
   this->LocalGenerator->AppendCustomDepends
     (depends, this->Target->GetPostBuildCommands());
+
   this->LocalGenerator->AppendCustomCommands
     (commands, this->Target->GetPreBuildCommands());
+  
+  // Depend on all custom command outputs for sources
+  const std::vector<cmSourceFile*>& sources =
+    this->Target->GetSourceFiles();
+  for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
+      source != sources.end(); ++source)
+    {
+    if(cmCustomCommand* cc = (*source)->GetCustomCommand())
+      {
+      this->LocalGenerator->AppendCustomCommand(commands, *cc);
+      this->LocalGenerator->AppendCustomDepend(depends, *cc);
+      }
+    }
+
   this->LocalGenerator->AppendCustomCommands
     (commands, this->Target->GetPostBuildCommands());
 
@@ -53,8 +79,7 @@
   this->AppendTargetDepends(depends);
   
   // Add a dependency on the rule file itself.
-  std::string relPath = this->LocalGenerator->GetHomeRelativeOutputPath();
-  std::string objTarget = relPath;
+  objTarget = relPath;
   objTarget += this->BuildFileName;
   this->LocalGenerator->AppendRuleDepend(depends, objTarget.c_str());
 



More information about the Cmake-commits mailing list