[cmake-commits] hoffman committed cmAddDependenciesCommand.cxx 1.13 1.14 cmSetTargetPropertiesCommand.cxx 1.5 1.6

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Feb 7 11:49:44 EST 2007


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

Modified Files:
	cmAddDependenciesCommand.cxx cmSetTargetPropertiesCommand.cxx 
Log Message:
BUG: fix for bug 4414, find targets in the global generator for set_target_properties and add_dependencies


Index: cmAddDependenciesCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmAddDependenciesCommand.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cmAddDependenciesCommand.cxx	15 Mar 2006 16:01:58 -0000	1.13
+++ cmAddDependenciesCommand.cxx	7 Feb 2007 16:49:42 -0000	1.14
@@ -15,6 +15,8 @@
 
 =========================================================================*/
 #include "cmAddDependenciesCommand.h"
+#include "cmLocalGenerator.h"
+#include "cmGlobalGenerator.h"
 
 // cmDependenciesCommand
 bool cmAddDependenciesCommand::InitialPass(
@@ -28,14 +30,16 @@
 
   std::string target_name = args[0];
 
-  cmTargets &tgts = this->Makefile->GetTargets();
-  if (tgts.find(target_name) != tgts.end())
+  cmTarget* target = 
+    this->GetMakefile()->GetLocalGenerator()->
+    GetGlobalGenerator()->FindTarget(0, target_name.c_str());
+  if(target)
     {
     std::vector<std::string>::const_iterator s = args.begin();
-    ++s;
+    ++s; // skip over target_name
     for (; s != args.end(); ++s)
       {
-      tgts[target_name].AddUtility(s->c_str());
+      target->AddUtility(s->c_str());
       }
     }
   else
@@ -46,7 +50,6 @@
     return false;
     }
 
-
   return true;
 }
 

Index: cmSetTargetPropertiesCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmSetTargetPropertiesCommand.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cmSetTargetPropertiesCommand.cxx	7 Dec 2006 14:44:45 -0000	1.5
+++ cmSetTargetPropertiesCommand.cxx	7 Feb 2007 16:49:42 -0000	1.6
@@ -15,6 +15,8 @@
 
 =========================================================================*/
 #include "cmSetTargetPropertiesCommand.h"
+#include "cmLocalGenerator.h"
+#include "cmGlobalGenerator.h"
 
 // cmSetTargetPropertiesCommand
 bool cmSetTargetPropertiesCommand::InitialPass(
@@ -93,19 +95,16 @@
                std::vector<std::string> &propertyPairs,
                cmMakefile *mf)
 {
-  cmTargets& targets = mf->GetTargets();
-
-  // if the file is already in the makefile just set properites on it
-  cmTargets::iterator t = targets.find(tname);
-  if ( t != targets.end())
+  cmTarget* target = 
+    mf->GetLocalGenerator()->GetGlobalGenerator()->FindTarget(0, tname);
+  if ( target)
     {
-    cmTarget& target = t->second;
     // now loop through all the props and set them
     unsigned int k;
     for (k = 0; k < propertyPairs.size(); k = k + 2)
       {
-      target.SetProperty(propertyPairs[k].c_str(),
-                         propertyPairs[k+1].c_str());
+      target->SetProperty(propertyPairs[k].c_str(),
+                          propertyPairs[k+1].c_str());
       }
     }
   // if file is not already in the makefile, then add it



More information about the Cmake-commits mailing list