[cmake-commits] king committed cmMakefileExecutableTargetGenerator.cxx 1.33 1.34 cmMakefileLibraryTargetGenerator.cxx 1.39 1.40 cmMakefileTargetGenerator.cxx 1.61 1.62 cmMakefileTargetGenerator.h 1.14 1.15 cmMakefileUtilityTargetGenerator.cxx 1.5 1.6

cmake-commits at cmake.org cmake-commits at cmake.org
Tue May 1 13:51:27 EDT 2007


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

Modified Files:
	cmMakefileExecutableTargetGenerator.cxx 
	cmMakefileLibraryTargetGenerator.cxx 
	cmMakefileTargetGenerator.cxx cmMakefileTargetGenerator.h 
	cmMakefileUtilityTargetGenerator.cxx 
Log Message:
BUG: A utility target should not run the custom commands from its source files directly.  The target-level rule must add dependencies on the file-level custom commands to drive them.  This bug was introduced by the "fix" to bug 4377.  This also restores the documented behavior that PRE_BUILD rules are treated as PRE_LINK rules on non-VS generators.  Also fixed custom command dependencies on the rule file build.make so that custom commands re-run when the commands themselves change.


Index: cmMakefileLibraryTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileLibraryTargetGenerator.cxx,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- cmMakefileLibraryTargetGenerator.cxx	19 Mar 2007 14:00:35 -0000	1.39
+++ cmMakefileLibraryTargetGenerator.cxx	1 May 2007 17:51:25 -0000	1.40
@@ -29,7 +29,7 @@
 //----------------------------------------------------------------------------
 cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator()
 {
-  this->DriveCustomCommandsOnDepends = true;
+  this->CustomCommandDriver = OnDepends;
 }
 
 //----------------------------------------------------------------------------

Index: cmMakefileTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- cmMakefileTargetGenerator.h	9 Mar 2007 16:29:15 -0000	1.14
+++ cmMakefileTargetGenerator.h	1 May 2007 17:51:25 -0000	1.15
@@ -129,7 +129,8 @@
   cmGlobalUnixMakefileGenerator3 *GlobalGenerator;
   cmMakefile *Makefile;
 
-  bool DriveCustomCommandsOnDepends;
+  enum CustomCommandDriveType { OnBuild, OnDepends, OnUtility };
+  CustomCommandDriveType CustomCommandDriver;
 
   // the full path to the build file
   std::string BuildFileName;

Index: cmMakefileExecutableTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileExecutableTargetGenerator.cxx,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- cmMakefileExecutableTargetGenerator.cxx	18 Apr 2007 03:39:47 -0000	1.33
+++ cmMakefileExecutableTargetGenerator.cxx	1 May 2007 17:51:25 -0000	1.34
@@ -27,7 +27,7 @@
 //----------------------------------------------------------------------------
 cmMakefileExecutableTargetGenerator::cmMakefileExecutableTargetGenerator()
 {
-  this->DriveCustomCommandsOnDepends = true;
+  this->CustomCommandDriver = OnDepends;
 }
 
 //----------------------------------------------------------------------------

Index: cmMakefileTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileTargetGenerator.cxx,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- cmMakefileTargetGenerator.cxx	30 Mar 2007 14:53:02 -0000	1.61
+++ cmMakefileTargetGenerator.cxx	1 May 2007 17:51:25 -0000	1.62
@@ -35,7 +35,7 @@
   this->BuildFileStream = 0;
   this->InfoFileStream = 0;
   this->FlagFileStream = 0;
-  this->DriveCustomCommandsOnDepends = false;
+  this->CustomCommandDriver = OnBuild;
 }
 
 cmMakefileTargetGenerator *
@@ -788,7 +788,7 @@
   commands.push_back(depCmd.str());
 
   // Make sure all custom command outputs in this target are built.
-  if(this->DriveCustomCommandsOnDepends)
+  if(this->CustomCommandDriver == OnDepends)
     {
     this->DriveCustomCommands(depends);
     }
@@ -874,6 +874,10 @@
   std::vector<std::string> depends;
   this->LocalGenerator->AppendCustomDepend(depends, cc);
 
+  // Add a dependency on the rule file itself.
+  this->LocalGenerator->AppendRuleDepend(depends,
+                                         this->BuildFileNameFull.c_str());
+
   // Check whether we need to bother checking for a symbolic output.
   bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark();
 
@@ -1096,7 +1100,7 @@
     comment = "Rule to build all files generated by this target.";
 
     // Make sure all custom command outputs in this target are built.
-    if(!this->DriveCustomCommandsOnDepends)
+    if(this->CustomCommandDriver == OnBuild)
       {
       this->DriveCustomCommands(depends);
       }

Index: cmMakefileUtilityTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefileUtilityTargetGenerator.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cmMakefileUtilityTargetGenerator.cxx	2 Mar 2007 19:31:04 -0000	1.5
+++ cmMakefileUtilityTargetGenerator.cxx	1 May 2007 17:51:25 -0000	1.6
@@ -26,10 +26,9 @@
 //----------------------------------------------------------------------------
 cmMakefileUtilityTargetGenerator::cmMakefileUtilityTargetGenerator()
 {
-  this->DriveCustomCommandsOnDepends = true;
+  this->CustomCommandDriver = OnUtility;
 }
 
-
 //----------------------------------------------------------------------------
 void cmMakefileUtilityTargetGenerator::WriteRuleFiles()
 {
@@ -49,39 +48,24 @@
   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->DriveCustomCommands(depends);
 
   this->LocalGenerator->AppendCustomCommands
     (commands, this->Target->GetPostBuildCommands());
 
   // Add dependencies on targets that must be built first.
   this->AppendTargetDepends(depends);
-  
+
   // Add a dependency on the rule file itself.
-  objTarget = relPath;
-  objTarget += this->BuildFileName;
-  this->LocalGenerator->AppendRuleDepend(depends, objTarget.c_str());
+  this->LocalGenerator->AppendRuleDepend(depends,
+                                         this->BuildFileNameFull.c_str());
 
   // If the rule is empty add the special empty rule dependency needed
   // by some make tools.



More information about the Cmake-commits mailing list