summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2005-03-04 03:35:06 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2005-03-04 03:35:06 (GMT)
commita9a0c91630401a84bbbc48c07e9a9e3cd7d81761 (patch)
tree11aa6472ee2349b94151e29671325ada15dca238
parented1afcdaee356c0e353f00c27a57014dc59023ab (diff)
downloadCMake-a9a0c91630401a84bbbc48c07e9a9e3cd7d81761.zip
CMake-a9a0c91630401a84bbbc48c07e9a9e3cd7d81761.tar.gz
CMake-a9a0c91630401a84bbbc48c07e9a9e3cd7d81761.tar.bz2
ENH: fix for finding the correct target in the current project
-rw-r--r--Source/cmGlobalGenerator.cxx12
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx37
3 files changed, 33 insertions, 18 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 0d66113..66b54ca 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -873,11 +873,17 @@ void cmGlobalGenerator::FillProjectMap()
}
-cmTarget* cmGlobalGenerator::FindTarget(const char* name)
+cmTarget* cmGlobalGenerator::FindTarget(const char* project,
+ const char* name)
{
- for(unsigned int i = 0; i < m_LocalGenerators.size(); ++i)
+ std::vector<cmLocalGenerator*>* gens = &m_LocalGenerators;
+ if(project)
{
- cmTarget* ret = m_LocalGenerators[i]->GetMakefile()->FindTarget(name);
+ gens = &m_ProjectMap[project];
+ }
+ for(unsigned int i = 0; i < gens->size(); ++i)
+ {
+ cmTarget* ret = (*gens)[i]->GetMakefile()->FindTarget(name);
if(ret)
{
return ret;
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 7832a96..7cce345 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -160,7 +160,7 @@ protected:
void RecursiveConfigure(cmLocalGenerator *lg, float start, float end);
///! Find a target by name by searching the local generators.
- cmTarget* FindTarget(const char* name);
+ cmTarget* FindTarget(const char* project, const char* name);
private:
// If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index ee204f9..94b0080 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -722,7 +722,8 @@ cmGlobalXCodeGenerator::AddCommandsToBuildPhase(cmXCodeObject* buildphase,
for(std::vector<std::string>::const_iterator d = cc.GetDepends().begin();
d != cc.GetDepends().end(); ++d)
{
- if(!this->FindTarget(d->c_str()))
+ if(!this->FindTarget(m_CurrentMakefile->GetProjectName(),
+ d->c_str()))
{
makefileStream << "\\\n" << this
->ConvertToRelativeForMake(d->c_str());
@@ -963,7 +964,6 @@ cmGlobalXCodeGenerator::CreateUtilityTarget(cmTarget& cmtarget)
"# shell script goes here\nexit 0"));
cmXCodeObject* target =
this->CreateObject(cmXCodeObject::PBXAggregateTarget);
-
cmXCodeObject* buildPhases =
this->CreateObject(cmXCodeObject::OBJECT_LIST);
this->CreateCustomCommands(buildPhases, 0, 0, 0, cmtarget);
@@ -992,7 +992,6 @@ cmGlobalXCodeGenerator::CreateXCodeTarget(cmTarget& cmtarget,
{
cmXCodeObject* target =
this->CreateObject(cmXCodeObject::PBXNativeTarget);
-
target->AddAttribute("buildPhases", buildPhases);
cmXCodeObject* buildRules = this->CreateObject(cmXCodeObject::OBJECT_LIST);
target->AddAttribute("buildRules", buildRules);
@@ -1091,7 +1090,9 @@ void cmGlobalXCodeGenerator::AddDependTarget(cmXCodeObject* target,
cmXCodeObject* depends = target->GetObject("dependencies");
if(!depends)
{
- std::cerr << "target does not have dependencies attribute error...\n";
+ cmSystemTools::
+ Error("target does not have dependencies attribute error..");
+
}
else
{
@@ -1161,7 +1162,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
cmTarget* cmtarget = target->GetcmTarget();
if(!cmtarget)
{
- std::cerr << "Error no target on xobject\n";
+ cmSystemTools::Error("Error no target on xobject\n");
return;
}
// compute the correct order for link libraries
@@ -1215,7 +1216,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
for(std::vector<cmStdString>::iterator lib = linkItems.begin();
lib != linkItems.end(); ++lib)
{
- cmTarget* t = this->FindTarget(lib->c_str());
+ cmTarget* t = this->FindTarget(m_CurrentMakefile->GetProjectName(),
+ lib->c_str());
cmXCodeObject* dptarget = this->FindXCodeTarget(t);
if(dptarget)
{
@@ -1239,7 +1241,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
= cmtarget->GetUtilities().begin();
i != cmtarget->GetUtilities().end(); ++i)
{
- cmTarget* t = this->FindTarget(i->c_str());
+ cmTarget* t = this->FindTarget(m_CurrentMakefile->GetProjectName(),
+ i->c_str());
cmXCodeObject* dptarget = this->FindXCodeTarget(t);
if(dptarget)
{
@@ -1247,12 +1250,19 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
}
else
{
- std::cerr << "Error Utility: " << i->c_str() << "\n";
- std::cerr << "cmtarget " << t << "\n";
- std::cerr << "Is on the target " << cmtarget->GetName() << "\n";
- std::cerr << "But it has no xcode target created yet??\n";
- std::cerr << "Current project is "
- << m_CurrentMakefile->GetProjectName() << "\n";
+ std::string m = "Error Utility: ";
+ m += i->c_str();
+ m += "\n";
+ m += "cmtarget ";
+ m += t->GetName();
+ m += "\n";
+ m += "Is on the target ";
+ m += cmtarget->GetName();
+ m += "\n";
+ m += "But it has no xcode target created yet??\n";
+ m += "Current project is ";
+ m += m_CurrentMakefile->GetProjectName();
+ cmSystemTools::Error(m.c_str());
}
}
std::vector<cmStdString> fullPathLibs;
@@ -1467,7 +1477,6 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
{
return;
}
-
this->CreateXCodeObjects(root,
generators);
std::string xcodeDir = root->GetMakefile()->GetStartOutputDirectory();