BUG: fix for bug 4414, find targets in the global generator for set_target_properties and add_dependencies

This commit is contained in:
Bill Hoffman 2007-02-07 11:49:42 -05:00
parent f548dc4a06
commit cbe95dffcc
2 changed files with 15 additions and 13 deletions

View File

@ -15,6 +15,8 @@
=========================================================================*/ =========================================================================*/
#include "cmAddDependenciesCommand.h" #include "cmAddDependenciesCommand.h"
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
// cmDependenciesCommand // cmDependenciesCommand
bool cmAddDependenciesCommand::InitialPass( bool cmAddDependenciesCommand::InitialPass(
@ -28,14 +30,16 @@ bool cmAddDependenciesCommand::InitialPass(
std::string target_name = args[0]; std::string target_name = args[0];
cmTargets &tgts = this->Makefile->GetTargets(); cmTarget* target =
if (tgts.find(target_name) != tgts.end()) this->GetMakefile()->GetLocalGenerator()->
GetGlobalGenerator()->FindTarget(0, target_name.c_str());
if(target)
{ {
std::vector<std::string>::const_iterator s = args.begin(); std::vector<std::string>::const_iterator s = args.begin();
++s; ++s; // skip over target_name
for (; s != args.end(); ++s) for (; s != args.end(); ++s)
{ {
tgts[target_name].AddUtility(s->c_str()); target->AddUtility(s->c_str());
} }
} }
else else
@ -46,7 +50,6 @@ bool cmAddDependenciesCommand::InitialPass(
return false; return false;
} }
return true; return true;
} }

View File

@ -15,6 +15,8 @@
=========================================================================*/ =========================================================================*/
#include "cmSetTargetPropertiesCommand.h" #include "cmSetTargetPropertiesCommand.h"
#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
// cmSetTargetPropertiesCommand // cmSetTargetPropertiesCommand
bool cmSetTargetPropertiesCommand::InitialPass( bool cmSetTargetPropertiesCommand::InitialPass(
@ -93,19 +95,16 @@ bool cmSetTargetPropertiesCommand
std::vector<std::string> &propertyPairs, std::vector<std::string> &propertyPairs,
cmMakefile *mf) cmMakefile *mf)
{ {
cmTargets& targets = mf->GetTargets(); cmTarget* target =
mf->GetLocalGenerator()->GetGlobalGenerator()->FindTarget(0, tname);
// if the file is already in the makefile just set properites on it if ( target)
cmTargets::iterator t = targets.find(tname);
if ( t != targets.end())
{ {
cmTarget& target = t->second;
// now loop through all the props and set them // now loop through all the props and set them
unsigned int k; unsigned int k;
for (k = 0; k < propertyPairs.size(); k = k + 2) for (k = 0; k < propertyPairs.size(); k = k + 2)
{ {
target.SetProperty(propertyPairs[k].c_str(), target->SetProperty(propertyPairs[k].c_str(),
propertyPairs[k+1].c_str()); propertyPairs[k+1].c_str());
} }
} }
// if file is not already in the makefile, then add it // if file is not already in the makefile, then add it