From cbe95dffccb75692fcba71ca3c7835e1b3f286bd Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 7 Feb 2007 11:49:42 -0500 Subject: BUG: fix for bug 4414, find targets in the global generator for set_target_properties and add_dependencies --- Source/cmAddDependenciesCommand.cxx | 13 ++++++++----- Source/cmSetTargetPropertiesCommand.cxx | 15 +++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index d994073..874c816 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -15,6 +15,8 @@ =========================================================================*/ #include "cmAddDependenciesCommand.h" +#include "cmLocalGenerator.h" +#include "cmGlobalGenerator.h" // cmDependenciesCommand bool cmAddDependenciesCommand::InitialPass( @@ -28,14 +30,16 @@ bool cmAddDependenciesCommand::InitialPass( 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::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 @@ bool cmAddDependenciesCommand::InitialPass( return false; } - return true; } diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx index f7910a0..342989d 100644 --- a/Source/cmSetTargetPropertiesCommand.cxx +++ b/Source/cmSetTargetPropertiesCommand.cxx @@ -15,6 +15,8 @@ =========================================================================*/ #include "cmSetTargetPropertiesCommand.h" +#include "cmLocalGenerator.h" +#include "cmGlobalGenerator.h" // cmSetTargetPropertiesCommand bool cmSetTargetPropertiesCommand::InitialPass( @@ -93,19 +95,16 @@ bool cmSetTargetPropertiesCommand std::vector &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 -- cgit v0.12