[cmake-commits] alex committed cmMakefile.cxx 1.385 1.385.2.1 cmTarget.cxx 1.134.4.2 1.134.4.3

cmake-commits at cmake.org cmake-commits at cmake.org
Tue May 8 10:05:16 EDT 2007


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

Modified Files:
      Tag: CMake-ACC-TargetUsedAsCommand
	cmMakefile.cxx cmTarget.cxx 
Log Message:

ENH: also detect targetnames-used-as-commands for PREBUILD/PRELINK/POSTBUILD
custom commands

Alex


Index: cmTarget.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTarget.cxx,v
retrieving revision 1.134.4.2
retrieving revision 1.134.4.3
diff -u -d -r1.134.4.2 -r1.134.4.3
--- cmTarget.cxx	7 May 2007 18:42:13 -0000	1.134.4.2
+++ cmTarget.cxx	8 May 2007 14:05:14 -0000	1.134.4.3
@@ -504,6 +504,63 @@
         }
       }
     }
+    
+  for ( std::vector<cmCustomCommand>::iterator cli = this->GetPreBuildCommands().begin();
+        cli != this->GetPreBuildCommands().end();
+        ++cli )
+    {
+    for ( cmCustomCommandLines::const_iterator cit=cli->GetCommandLines().begin();
+          cit!=cli->GetCommandLines().end();
+          ++cit )
+      {
+      std::string command = *cit->begin();
+      // see if we can find a target with this name
+      cmTarget* t =  this->Makefile->GetLocalGenerator()->
+                     GetGlobalGenerator()->FindTarget ( 0, command.c_str() );
+      if ( ( t ) && ( t->GetType() ==cmTarget::EXECUTABLE ) )
+        {
+        this->AddUtility ( command.c_str() );
+        }
+      }
+    }
+  for ( std::vector<cmCustomCommand>::iterator cli = this->GetPreLinkCommands().begin();
+        cli != this->GetPreLinkCommands().end();
+        ++cli )
+    {
+    for ( cmCustomCommandLines::const_iterator cit=cli->GetCommandLines().begin();
+          cit!=cli->GetCommandLines().end();
+          ++cit )
+      {
+      std::string command = *cit->begin();
+      // see if we can find a target with this name
+      cmTarget* t =  this->Makefile->GetLocalGenerator()->
+                     GetGlobalGenerator()->FindTarget ( 0, command.c_str() );
+      if ( ( t ) && ( t->GetType() ==cmTarget::EXECUTABLE ) )
+        {
+        this->AddUtility ( command.c_str() );
+        }
+      }
+    }
+    
+  for ( std::vector<cmCustomCommand>::iterator cli = this->GetPostBuildCommands().begin();
+        cli != this->GetPostBuildCommands().end();
+        ++cli )
+    {
+    for ( cmCustomCommandLines::const_iterator cit=cli->GetCommandLines().begin();
+          cit!=cli->GetCommandLines().end();
+          ++cit )
+      {
+      std::string command = *cit->begin();
+      // see if we can find a target with this name
+      cmTarget* t =  this->Makefile->GetLocalGenerator()->
+                     GetGlobalGenerator()->FindTarget ( 0, command.c_str() );
+      if ( ( t ) && ( t->GetType() ==cmTarget::EXECUTABLE ) )
+        {
+        this->AddUtility ( command.c_str() );
+        }
+      }
+    }
+
   while (!srcFilesToProcess.empty())
     {
     // is this source the output of a custom command

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.385
retrieving revision 1.385.2.1
diff -u -d -r1.385 -r1.385.2.1
--- cmMakefile.cxx	4 May 2007 13:50:39 -0000	1.385
+++ cmMakefile.cxx	8 May 2007 14:05:13 -0000	1.385.2.1
@@ -580,16 +580,18 @@
       }
 
     // Add dependencies on commands CMake knows how to build.
-    for(cmCustomCommandLines::const_iterator cli = commandLines.begin();
+/*    for(cmCustomCommandLines::const_iterator cli = commandLines.begin();
         cli != commandLines.end(); ++cli)
       {
       std::string cacheCommand = *cli->begin();
+      fprintf(stderr, "command: %s\n", cacheCommand.c_str());
       if(const char* knownTarget =
          this->GetCacheManager()->GetCacheValue(cacheCommand.c_str()))
         {
+      fprintf(stderr, "FOUND \n");
         ti->second.AddUtility(knownTarget);
         }
-      }
+      } */
     }
 }
 



More information about the Cmake-commits mailing list