Port to GetGeneratorTargets.

This commit is contained in:
Stephen Kelly 2015-10-18 17:06:14 +02:00
parent f528e6bcb9
commit 67b2f4312c
16 changed files with 238 additions and 226 deletions

View File

@ -175,13 +175,12 @@ void cmComputeTargetDepends::CollectTargets()
this->GlobalGenerator->GetLocalGenerators(); this->GlobalGenerator->GetLocalGenerators();
for(unsigned int i = 0; i < lgens.size(); ++i) for(unsigned int i = 0; i < lgens.size(); ++i)
{ {
const cmTargets& targets = lgens[i]->GetMakefile()->GetTargets(); const std::vector<cmGeneratorTarget*> targets =
for(cmTargets::const_iterator ti = targets.begin(); lgens[i]->GetGeneratorTargets();
for(std::vector<cmGeneratorTarget*>::const_iterator ti = targets.begin();
ti != targets.end(); ++ti) ti != targets.end(); ++ti)
{ {
cmTarget const* target = &ti->second; cmGeneratorTarget* gt = *ti;
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(target);
int index = static_cast<int>(this->Targets.size()); int index = static_cast<int>(this->Targets.size());
this->TargetIndex[gt] = index; this->TargetIndex[gt] = index;
this->Targets.push_back(gt); this->Targets.push_back(gt);

View File

@ -319,12 +319,12 @@ void cmExtraCodeBlocksGenerator
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin(); for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
lg!=lgs.end(); lg++) lg!=lgs.end(); lg++)
{ {
cmMakefile* makefile=(*lg)->GetMakefile(); std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
cmTargets& targets=makefile->GetTargets(); for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
for (cmTargets::iterator ti = targets.begin();
ti != targets.end(); ti++) ti != targets.end(); ti++)
{ {
switch(ti->second.GetType()) std::string targetName = (*ti)->GetName();
switch((*ti)->GetType())
{ {
case cmState::GLOBAL_TARGET: case cmState::GLOBAL_TARGET:
{ {
@ -333,7 +333,7 @@ void cmExtraCodeBlocksGenerator
if (strcmp((*lg)->GetCurrentBinaryDirectory(), if (strcmp((*lg)->GetCurrentBinaryDirectory(),
(*lg)->GetBinaryDirectory())==0) (*lg)->GetBinaryDirectory())==0)
{ {
this->AppendTarget(fout, ti->first, 0, this->AppendTarget(fout, targetName, 0,
make.c_str(), *lg, compiler.c_str()); make.c_str(), *lg, compiler.c_str());
} }
} }
@ -341,15 +341,16 @@ void cmExtraCodeBlocksGenerator
case cmState::UTILITY: case cmState::UTILITY:
// Add all utility targets, except the Nightly/Continuous/ // Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart // Experimental-"sub"targets as e.g. NightlyStart
if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly")) if (((targetName.find("Nightly")==0) &&(targetName!="Nightly"))
|| ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous")) || ((targetName.find("Continuous")==0)
|| ((ti->first.find("Experimental")==0) &&(targetName!="Continuous"))
&& (ti->first!="Experimental"))) || ((targetName.find("Experimental")==0)
&& (targetName!="Experimental")))
{ {
break; break;
} }
this->AppendTarget(fout, ti->first, 0, this->AppendTarget(fout, targetName, 0,
make.c_str(), *lg, compiler.c_str()); make.c_str(), *lg, compiler.c_str());
break; break;
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
@ -358,11 +359,10 @@ void cmExtraCodeBlocksGenerator
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
{ {
cmGeneratorTarget* gt = cmGeneratorTarget* gt = *ti;
this->GlobalGenerator->GetGeneratorTarget(&ti->second); this->AppendTarget(fout, targetName, gt,
this->AppendTarget(fout, ti->first, gt,
make.c_str(), *lg, compiler.c_str()); make.c_str(), *lg, compiler.c_str());
std::string fastTarget = ti->first; std::string fastTarget = targetName;
fastTarget += "/fast"; fastTarget += "/fast";
this->AppendTarget(fout, fastTarget, gt, this->AppendTarget(fout, fastTarget, gt,
make.c_str(), *lg, compiler.c_str()); make.c_str(), *lg, compiler.c_str());
@ -388,11 +388,11 @@ void cmExtraCodeBlocksGenerator
lg!=lgs.end(); lg++) lg!=lgs.end(); lg++)
{ {
cmMakefile* makefile=(*lg)->GetMakefile(); cmMakefile* makefile=(*lg)->GetMakefile();
cmTargets& targets=makefile->GetTargets(); std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
for (cmTargets::iterator ti = targets.begin(); for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ti++) ti != targets.end(); ti++)
{ {
switch(ti->second.GetType()) switch((*ti)->GetType())
{ {
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
@ -402,8 +402,7 @@ void cmExtraCodeBlocksGenerator
case cmState::UTILITY: // can have sources since 2.6.3 case cmState::UTILITY: // can have sources since 2.6.3
{ {
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
cmGeneratorTarget* gt = cmGeneratorTarget* gt = *ti;
this->GlobalGenerator->GetGeneratorTarget(&ti->second);
gt->GetSourceFiles(sources, gt->GetSourceFiles(sources,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin(); for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
@ -442,7 +441,7 @@ void cmExtraCodeBlocksGenerator
} }
CbpUnit &cbpUnit = allFiles[fullPath]; CbpUnit &cbpUnit = allFiles[fullPath];
cbpUnit.Targets.push_back(&(ti->second)); cbpUnit.Targets.push_back((*ti)->Target);
} }
} }
default: // intended fallthrough default: // intended fallthrough

View File

@ -155,12 +155,12 @@ void cmExtraCodeLiteGenerator
lg!=lgs.end(); lg++) lg!=lgs.end(); lg++)
{ {
cmMakefile* makefile=(*lg)->GetMakefile(); cmMakefile* makefile=(*lg)->GetMakefile();
cmTargets& targets=makefile->GetTargets(); std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
for (cmTargets::iterator ti = targets.begin(); for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ti++) ti != targets.end(); ti++)
{ {
switch(ti->second.GetType()) switch((*ti)->GetType())
{ {
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
{ {
@ -186,7 +186,7 @@ void cmExtraCodeLiteGenerator
break; break;
} }
switch(ti->second.GetType()) switch((*ti)->GetType())
{ {
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
@ -194,8 +194,7 @@ void cmExtraCodeLiteGenerator
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
{ {
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
cmGeneratorTarget* gt = cmGeneratorTarget* gt = *ti;
this->GlobalGenerator->GetGeneratorTarget(&ti->second);
gt->GetSourceFiles(sources, gt->GetSourceFiles(sources,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin(); for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();

View File

@ -536,13 +536,15 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
++lgIt) ++lgIt)
{ {
cmMakefile* makefile = (*lgIt)->GetMakefile(); cmMakefile* makefile = (*lgIt)->GetMakefile();
const cmTargets& targets = makefile->GetTargets(); const std::vector<cmGeneratorTarget*> targets =
(*lgIt)->GetGeneratorTargets();
for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end();++ti) for(std::vector<cmGeneratorTarget*>::const_iterator ti=targets.begin();
ti!=targets.end();++ti)
{ {
std::string linkName2 = linkName; std::string linkName2 = linkName;
linkName2 += "/"; linkName2 += "/";
switch(ti->second.GetType()) switch((*ti)->GetType())
{ {
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
@ -550,10 +552,10 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
{ {
const char* prefix = (ti->second.GetType()==cmState::EXECUTABLE ? const char* prefix = ((*ti)->GetType()==cmState::EXECUTABLE ?
"[exe] " : "[lib] "); "[exe] " : "[lib] ");
linkName2 += prefix; linkName2 += prefix;
linkName2 += ti->first; linkName2 += (*ti)->GetName();
this->AppendLinkedResource(fout, linkName2, "virtual:/virtual", this->AppendLinkedResource(fout, linkName2, "virtual:/virtual",
VirtualFolder); VirtualFolder);
if (!this->GenerateLinkedResources) if (!this->GenerateLinkedResources)
@ -562,10 +564,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
} }
std::vector<cmSourceGroup> sourceGroups=makefile->GetSourceGroups(); std::vector<cmSourceGroup> sourceGroups=makefile->GetSourceGroups();
// get the files from the source lists then add them to the groups // get the files from the source lists then add them to the groups
cmTarget* tgt = const_cast<cmTarget*>(&ti->second); cmGeneratorTarget* gt = const_cast<cmGeneratorTarget*>(*ti);
std::vector<cmSourceFile*> files; std::vector<cmSourceFile*> files;
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(tgt);
gt->GetSourceFiles(files, gt->GetSourceFiles(files,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin(); for(std::vector<cmSourceFile*>::const_iterator sfIt = files.begin();
@ -1030,7 +1030,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
it != this->GlobalGenerator->GetLocalGenerators().end(); it != this->GlobalGenerator->GetLocalGenerators().end();
++it) ++it)
{ {
const cmTargets& targets = (*it)->GetMakefile()->GetTargets(); const std::vector<cmGeneratorTarget*> targets =
(*it)->GetGeneratorTargets();
std::string subdir = (*it)->Convert((*it)->GetCurrentBinaryDirectory(), std::string subdir = (*it)->Convert((*it)->GetCurrentBinaryDirectory(),
cmLocalGenerator::HOME_OUTPUT); cmLocalGenerator::HOME_OUTPUT);
if (subdir == ".") if (subdir == ".")
@ -1038,9 +1039,11 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
subdir = ""; subdir = "";
} }
for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti) for(std::vector<cmGeneratorTarget*>::const_iterator ti =
targets.begin(); ti!=targets.end(); ++ti)
{ {
switch(ti->second.GetType()) std::string targetName = (*ti)->GetName();
switch((*ti)->GetType())
{ {
case cmState::GLOBAL_TARGET: case cmState::GLOBAL_TARGET:
{ {
@ -1048,22 +1051,22 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// not from the subdirs // not from the subdirs
if (subdir.empty()) if (subdir.empty())
{ {
this->AppendTarget(fout, ti->first, make, makeArgs, subdir, ": "); this->AppendTarget(fout, targetName, make, makeArgs, subdir, ": ");
} }
} }
break; break;
case cmState::UTILITY: case cmState::UTILITY:
// Add all utility targets, except the Nightly/Continuous/ // Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart // Experimental-"sub"targets as e.g. NightlyStart
if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly")) if (((targetName.find("Nightly")==0) &&(targetName!="Nightly"))
|| ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous")) || ((targetName.find("Continuous")==0)&&(targetName!="Continuous"))
|| ((ti->first.find("Experimental")==0) || ((targetName.find("Experimental")==0)
&& (ti->first!="Experimental"))) && (targetName!="Experimental")))
{ {
break; break;
} }
this->AppendTarget(fout, ti->first, make, makeArgs, subdir, ": "); this->AppendTarget(fout, targetName, make, makeArgs, subdir, ": ");
break; break;
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
@ -1071,10 +1074,10 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
{ {
const char* prefix = (ti->second.GetType()==cmState::EXECUTABLE ? const char* prefix = ((*ti)->GetType()==cmState::EXECUTABLE ?
"[exe] " : "[lib] "); "[exe] " : "[lib] ");
this->AppendTarget(fout, ti->first, make, makeArgs, subdir, prefix); this->AppendTarget(fout, targetName, make, makeArgs, subdir, prefix);
std::string fastTarget = ti->first; std::string fastTarget = targetName;
fastTarget += "/fast"; fastTarget += "/fast";
this->AppendTarget(fout, fastTarget, make, makeArgs, subdir, prefix); this->AppendTarget(fout, fastTarget, make, makeArgs, subdir, prefix);
@ -1083,21 +1086,20 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
{ {
std::string virtDir = "[Targets]/"; std::string virtDir = "[Targets]/";
virtDir += prefix; virtDir += prefix;
virtDir += ti->first; virtDir += targetName;
std::string buildArgs = "-C \""; std::string buildArgs = "-C \"";
buildArgs += (*it)->GetBinaryDirectory(); buildArgs += (*it)->GetBinaryDirectory();
buildArgs += "\" "; buildArgs += "\" ";
buildArgs += makeArgs; buildArgs += makeArgs;
this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "", this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "",
ti->first.c_str()); targetName.c_str());
std::string cleanArgs = "-E chdir \""; std::string cleanArgs = "-E chdir \"";
cleanArgs += (*it)->GetCurrentBinaryDirectory(); cleanArgs += (*it)->GetCurrentBinaryDirectory();
cleanArgs += "\" \""; cleanArgs += "\" \"";
cleanArgs += cmSystemTools::GetCMakeCommand(); cleanArgs += cmSystemTools::GetCMakeCommand();
cleanArgs += "\" -P \""; cleanArgs += "\" -P \"";
cmGeneratorTarget* gt = cmGeneratorTarget* gt = *ti;
this->GlobalGenerator->GetGeneratorTarget(&ti->second);
cleanArgs += (*it)->GetTargetDirectory(gt); cleanArgs += (*it)->GetTargetDirectory(gt);
cleanArgs += "/cmake_clean.cmake\""; cleanArgs += "/cmake_clean.cmake\"";
this->AppendTarget(fout, "Clean", cmSystemTools::GetCMakeCommand(), this->AppendTarget(fout, "Clean", cmSystemTools::GetCMakeCommand(),

View File

@ -119,14 +119,16 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
it != this->GlobalGenerator->GetLocalGenerators().end(); it != this->GlobalGenerator->GetLocalGenerators().end();
++it) ++it)
{ {
const cmTargets& targets = (*it)->GetMakefile()->GetTargets(); const std::vector<cmGeneratorTarget*> targets =
cmMakefile* makefile=(*it)->GetMakefile(); (*it)->GetGeneratorTargets();
std::string currentDir = (*it)->GetCurrentBinaryDirectory(); std::string currentDir = (*it)->GetCurrentBinaryDirectory();
bool topLevel = (currentDir == (*it)->GetBinaryDirectory()); bool topLevel = (currentDir == (*it)->GetBinaryDirectory());
for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti) for(std::vector<cmGeneratorTarget*>::const_iterator ti =
targets.begin(); ti!=targets.end(); ++ti)
{ {
switch(ti->second.GetType()) std::string targetName = (*ti)->GetName();
switch((*ti)->GetType())
{ {
case cmState::GLOBAL_TARGET: case cmState::GLOBAL_TARGET:
{ {
@ -138,9 +140,9 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
insertTarget = true; insertTarget = true;
// only add the "edit_cache" target if it's not ccmake, because // only add the "edit_cache" target if it's not ccmake, because
// this will not work within the IDE // this will not work within the IDE
if (ti->first == "edit_cache") if (targetName == "edit_cache")
{ {
const char* editCommand = makefile->GetDefinition const char* editCommand = (*it)->GetMakefile()->GetDefinition
("CMAKE_EDIT_COMMAND"); ("CMAKE_EDIT_COMMAND");
if (editCommand == 0) if (editCommand == 0)
{ {
@ -154,7 +156,7 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
} }
if (insertTarget) if (insertTarget)
{ {
this->AppendTarget(fout, ti->first, make, makeArgs, this->AppendTarget(fout, targetName, make, makeArgs,
currentDir, homeOutputDir); currentDir, homeOutputDir);
} }
} }
@ -162,15 +164,16 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
case cmState::UTILITY: case cmState::UTILITY:
// Add all utility targets, except the Nightly/Continuous/ // Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart // Experimental-"sub"targets as e.g. NightlyStart
if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly")) if (((targetName.find("Nightly")==0) &&(targetName!="Nightly"))
|| ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous")) || ((targetName.find("Continuous")==0)
|| ((ti->first.find("Experimental")==0) &&(targetName!="Continuous"))
&& (ti->first!="Experimental"))) || ((targetName.find("Experimental")==0)
&& (targetName!="Experimental")))
{ {
break; break;
} }
this->AppendTarget(fout, ti->first, make, makeArgs, this->AppendTarget(fout, targetName, make, makeArgs,
currentDir, homeOutputDir); currentDir, homeOutputDir);
break; break;
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
@ -179,9 +182,9 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
{ {
this->AppendTarget(fout, ti->first, make, makeArgs, this->AppendTarget(fout, targetName, make, makeArgs,
currentDir, homeOutputDir); currentDir, homeOutputDir);
std::string fastTarget = ti->first; std::string fastTarget = targetName;
fastTarget += "/fast"; fastTarget += "/fast";
this->AppendTarget(fout, fastTarget, make, makeArgs, this->AppendTarget(fout, fastTarget, make, makeArgs,
currentDir, homeOutputDir); currentDir, homeOutputDir);

View File

@ -162,11 +162,12 @@ void cmExtraSublimeTextGenerator::
lg!=lgs.end(); lg++) lg!=lgs.end(); lg++)
{ {
cmMakefile* makefile=(*lg)->GetMakefile(); cmMakefile* makefile=(*lg)->GetMakefile();
cmTargets& targets=makefile->GetTargets(); std::vector<cmGeneratorTarget*> targets=(*lg)->GetGeneratorTargets();
for (cmTargets::iterator ti = targets.begin(); for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ti++) ti != targets.end(); ti++)
{ {
switch(ti->second.GetType()) std::string targetName = (*ti)->GetName();
switch((*ti)->GetType())
{ {
case cmState::GLOBAL_TARGET: case cmState::GLOBAL_TARGET:
{ {
@ -175,7 +176,7 @@ void cmExtraSublimeTextGenerator::
if (strcmp((*lg)->GetCurrentBinaryDirectory(), if (strcmp((*lg)->GetCurrentBinaryDirectory(),
(*lg)->GetBinaryDirectory())==0) (*lg)->GetBinaryDirectory())==0)
{ {
this->AppendTarget(fout, ti->first, *lg, 0, this->AppendTarget(fout, targetName, *lg, 0,
make.c_str(), makefile, compiler.c_str(), make.c_str(), makefile, compiler.c_str(),
sourceFileFlags, false); sourceFileFlags, false);
} }
@ -184,15 +185,16 @@ void cmExtraSublimeTextGenerator::
case cmState::UTILITY: case cmState::UTILITY:
// Add all utility targets, except the Nightly/Continuous/ // Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart // Experimental-"sub"targets as e.g. NightlyStart
if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly")) if (((targetName.find("Nightly")==0) &&(targetName!="Nightly"))
|| ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous")) || ((targetName.find("Continuous")==0)
|| ((ti->first.find("Experimental")==0) &&(targetName!="Continuous"))
&& (ti->first!="Experimental"))) || ((targetName.find("Experimental")==0)
&& (targetName!="Experimental")))
{ {
break; break;
} }
this->AppendTarget(fout, ti->first, *lg, 0, this->AppendTarget(fout, targetName, *lg, 0,
make.c_str(), makefile, compiler.c_str(), make.c_str(), makefile, compiler.c_str(),
sourceFileFlags, false); sourceFileFlags, false);
break; break;
@ -202,12 +204,12 @@ void cmExtraSublimeTextGenerator::
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
{ {
this->AppendTarget(fout, ti->first, *lg, &ti->second, this->AppendTarget(fout, targetName, *lg, (*ti)->Target,
make.c_str(), makefile, compiler.c_str(), make.c_str(), makefile, compiler.c_str(),
sourceFileFlags, false); sourceFileFlags, false);
std::string fastTarget = ti->first; std::string fastTarget = targetName;
fastTarget += "/fast"; fastTarget += "/fast";
this->AppendTarget(fout, fastTarget, *lg, &ti->second, this->AppendTarget(fout, fastTarget, *lg, (*ti)->Target,
make.c_str(), makefile, compiler.c_str(), make.c_str(), makefile, compiler.c_str(),
sourceFileFlags, false); sourceFileFlags, false);
} }

View File

@ -1468,34 +1468,34 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{ {
cmTargets& targets = std::vector<cmGeneratorTarget*> targets =
this->LocalGenerators[i]->GetMakefile()->GetTargets(); this->LocalGenerators[i]->GetGeneratorTargets();
std::vector<cmGeneratorTarget*> filteredTargets; std::vector<cmGeneratorTarget*> filteredTargets;
filteredTargets.reserve(targets.size()); filteredTargets.reserve(targets.size());
for(cmTargets::iterator ti = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ++ti) ti != targets.end(); ++ti)
{ {
if (ti->second.GetType() == cmState::GLOBAL_TARGET) if ((*ti)->GetType() == cmState::GLOBAL_TARGET)
{ {
continue; continue;
} }
if(ti->second.GetType() != cmState::EXECUTABLE && if((*ti)->GetType() != cmState::EXECUTABLE &&
ti->second.GetType() != cmState::STATIC_LIBRARY && (*ti)->GetType() != cmState::STATIC_LIBRARY &&
ti->second.GetType() != cmState::SHARED_LIBRARY && (*ti)->GetType() != cmState::SHARED_LIBRARY &&
ti->second.GetType() != cmState::MODULE_LIBRARY && (*ti)->GetType() != cmState::MODULE_LIBRARY &&
ti->second.GetType() != cmState::OBJECT_LIBRARY) (*ti)->GetType() != cmState::OBJECT_LIBRARY)
{ {
continue; continue;
} }
if((!ti->second.GetPropertyAsBool("AUTOMOC") if((!(*ti)->GetPropertyAsBool("AUTOMOC")
&& !ti->second.GetPropertyAsBool("AUTOUIC") && !(*ti)->GetPropertyAsBool("AUTOUIC")
&& !ti->second.GetPropertyAsBool("AUTORCC")) && !(*ti)->GetPropertyAsBool("AUTORCC"))
|| ti->second.IsImported()) || (*ti)->IsImported())
{ {
continue; continue;
} }
// don't do anything if there is no Qt4 or Qt5Core (which contains moc): // don't do anything if there is no Qt4 or Qt5Core (which contains moc):
cmMakefile* mf = ti->second.GetMakefile(); cmMakefile* mf = (*ti)->Target->GetMakefile();
std::string qtMajorVersion = mf->GetSafeDefinition("QT_VERSION_MAJOR"); std::string qtMajorVersion = mf->GetSafeDefinition("QT_VERSION_MAJOR");
if (qtMajorVersion == "") if (qtMajorVersion == "")
{ {
@ -1506,7 +1506,7 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
continue; continue;
} }
cmGeneratorTarget* gt = this->GetGeneratorTarget(&ti->second); cmGeneratorTarget* gt = *ti;
cmQtAutoGeneratorInitializer::InitializeAutogenSources(gt); cmQtAutoGeneratorInitializer::InitializeAutogenSources(gt);
filteredTargets.push_back(gt); filteredTargets.push_back(gt);
@ -2706,23 +2706,22 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
{ {
continue; continue;
} }
cmMakefile* mf = (*i)->GetMakefile();
// Get the targets in the makefile // Get the targets in the makefile
cmTargets &tgts = mf->GetTargets(); std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets();
// loop over all the targets // loop over all the targets
for (cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l)
{ {
cmTarget* target = &l->second; cmGeneratorTarget* target = *l;
cmGeneratorTarget* gt = this->GetGeneratorTarget(target); if(this->IsRootOnlyTarget(target) &&
if(this->IsRootOnlyTarget(gt) && target->GetLocalGenerator() != root)
target->GetMakefile() != root->GetMakefile())
{ {
continue; continue;
} }
// put the target in the set of original targets // put the target in the set of original targets
originalTargets.insert(gt); originalTargets.insert(target);
// Get the set of targets that depend on target // Get the set of targets that depend on target
this->AddTargetDepends(gt, projectTargets); this->AddTargetDepends(target, projectTargets);
} }
} }
} }

View File

@ -133,14 +133,13 @@ bool cmGlobalKdevelopGenerator
} }
//get all sources //get all sources
cmTargets& targets=makefile->GetTargets(); std::vector<cmGeneratorTarget*> targets=(*it)->GetGeneratorTargets();
for (cmTargets::iterator ti = targets.begin(); for (std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ti++) ti != targets.end(); ti++)
{ {
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
cmGeneratorTarget* gt = cmGeneratorTarget* gt = *ti;
this->GlobalGenerator->GetGeneratorTarget(&ti->second); gt->GetSourceFiles(sources, gt->Target->GetMakefile()
gt->GetSourceFiles(sources, ti->second.GetMakefile()
->GetSafeDefinition("CMAKE_BUILD_TYPE")); ->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for (std::vector<cmSourceFile*>::const_iterator si=sources.begin(); for (std::vector<cmSourceFile*>::const_iterator si=sources.begin();
si!=sources.end(); si++) si!=sources.end(); si++)

View File

@ -423,17 +423,18 @@ void cmGlobalUnixMakefileGenerator3
{ {
lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]); lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]);
// for all of out targets // for all of out targets
for (cmTargets::iterator l = lg->GetMakefile()->GetTargets().begin(); std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
l != lg->GetMakefile()->GetTargets().end(); l++) for (std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++)
{ {
if((l->second.GetType() == cmState::EXECUTABLE) || if(((*l)->GetType() == cmState::EXECUTABLE) ||
(l->second.GetType() == cmState::STATIC_LIBRARY) || ((*l)->GetType() == cmState::STATIC_LIBRARY) ||
(l->second.GetType() == cmState::SHARED_LIBRARY) || ((*l)->GetType() == cmState::SHARED_LIBRARY) ||
(l->second.GetType() == cmState::MODULE_LIBRARY) || ((*l)->GetType() == cmState::MODULE_LIBRARY) ||
(l->second.GetType() == cmState::OBJECT_LIBRARY) || ((*l)->GetType() == cmState::OBJECT_LIBRARY) ||
(l->second.GetType() == cmState::UTILITY)) ((*l)->GetType() == cmState::UTILITY))
{ {
cmGeneratorTarget* gt = this->GetGeneratorTarget(&l->second); cmGeneratorTarget* gt = *l;
std::string tname = lg->GetRelativeTargetDirectory(gt); std::string tname = lg->GetRelativeTargetDirectory(gt);
tname += "/DependInfo.cmake"; tname += "/DependInfo.cmake";
cmSystemTools::ConvertToUnixSlashes(tname); cmSystemTools::ConvertToUnixSlashes(tname);
@ -914,13 +915,11 @@ void cmGlobalUnixMakefileGenerator3::InitializeProgressMarks()
lgi != this->LocalGenerators.end(); ++lgi) lgi != this->LocalGenerators.end(); ++lgi)
{ {
cmLocalGenerator* lg = *lgi; cmLocalGenerator* lg = *lgi;
cmMakefile* mf = lg->GetMakefile(); std::vector<cmGeneratorTarget*> targets = lg->GetGeneratorTargets();
cmTargets const& targets = mf->GetTargets(); for(std::vector<cmGeneratorTarget*>::const_iterator t = targets.begin();
for(cmTargets::const_iterator t = targets.begin(); t != targets.end(); ++t) t != targets.end(); ++t)
{ {
cmTarget const& target = t->second; cmGeneratorTarget* gt = *t;
cmGeneratorTarget* gt = this->GetGeneratorTarget(&target);
cmLocalGenerator* tlg = gt->GetLocalGenerator(); cmLocalGenerator* tlg = gt->GetLocalGenerator();
@ -1089,11 +1088,12 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
if (lg2 == lg || lg->GetMakefile()->IsRootMakefile()) if (lg2 == lg || lg->GetMakefile()->IsRootMakefile())
{ {
// for each target Generate the rule files for each target. // for each target Generate the rule files for each target.
cmTargets& targets = lg2->GetMakefile()->GetTargets(); std::vector<cmGeneratorTarget*> targets = lg2->GetGeneratorTargets();
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) for(std::vector<cmGeneratorTarget*>::iterator t = targets.begin();
t != targets.end(); ++t)
{ {
cmTarget const& target = t->second; cmGeneratorTarget* target = *t;
cmState::TargetType type = target.GetType(); cmState::TargetType type = target->GetType();
if((type == cmState::EXECUTABLE) || if((type == cmState::EXECUTABLE) ||
(type == cmState::STATIC_LIBRARY) || (type == cmState::STATIC_LIBRARY) ||
(type == cmState::SHARED_LIBRARY) || (type == cmState::SHARED_LIBRARY) ||
@ -1102,7 +1102,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
(type == cmState::GLOBAL_TARGET) || (type == cmState::GLOBAL_TARGET) ||
(type == cmState::UTILITY)) (type == cmState::UTILITY))
{ {
std::string name = target.GetName(); std::string name = target->GetName();
if(emittedTargets.insert(name).second) if(emittedTargets.insert(name).second)
{ {
path = "... "; path = "... ";

View File

@ -375,11 +375,11 @@ bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
for(std::vector<cmLocalGenerator*>::iterator i = gen.begin(); for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
i != gen.end(); ++i) i != gen.end(); ++i)
{ {
cmTargets& targets = (*i)->GetMakefile()->GetTargets(); std::vector<cmGeneratorTarget*> targets = (*i)->GetGeneratorTargets();
for(cmTargets::iterator ti = targets.begin(); for(std::vector<cmGeneratorTarget*>::iterator ti = targets.begin();
ti != targets.end(); ++ti) ti != targets.end(); ++ti)
{ {
this->ComputeVSTargetDepends(ti->second); this->ComputeVSTargetDepends(*(*ti)->Target);
} }
} }
} }

View File

@ -510,17 +510,20 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
continue; continue;
} }
cmTargets& tgts = lg->GetMakefile()->GetTargets(); std::vector<cmGeneratorTarget*> tgts = lg->GetGeneratorTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++)
{ {
cmTarget& target = l->second; cmTarget& target = *(*l)->Target;
if (target.GetType() == cmState::GLOBAL_TARGET) if (target.GetType() == cmState::GLOBAL_TARGET)
{ {
continue; continue;
} }
if (regenerate && (l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)) std::string targetName = target.GetName();
if (regenerate && (targetName != CMAKE_CHECK_BUILD_SYSTEM_TARGET))
{ {
target.AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); target.AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
} }
@ -1085,21 +1088,26 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
targets) targets)
{ {
this->SetCurrentLocalGenerator(gen); this->SetCurrentLocalGenerator(gen);
cmTargets &tgts = this->CurrentMakefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts =
typedef std::map<std::string, cmTarget*, cmCompareTargets> cmSortedTargets; this->CurrentLocalGenerator->GetGeneratorTargets();
typedef std::map<std::string, cmGeneratorTarget*, cmCompareTargets>
cmSortedTargets;
cmSortedTargets sortedTargets; cmSortedTargets sortedTargets;
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++)
{ {
sortedTargets[l->first] = &l->second; sortedTargets[(*l)->GetName()] = *l;
} }
for(cmSortedTargets::iterator l = sortedTargets.begin(); for(cmSortedTargets::iterator l = sortedTargets.begin();
l != sortedTargets.end(); l++) l != sortedTargets.end(); l++)
{ {
cmTarget& cmtarget = *l->second; cmGeneratorTarget* gtgt = l->second;
cmGeneratorTarget* gtgt = this->GetGeneratorTarget(&cmtarget); cmTarget& cmtarget = *gtgt->Target;
std::string targetName = gtgt->GetName();
// make sure ALL_BUILD, INSTALL, etc are only done once // make sure ALL_BUILD, INSTALL, etc are only done once
if(this->SpecialTargetEmitted(l->first.c_str())) if(this->SpecialTargetEmitted(targetName.c_str()))
{ {
continue; continue;
} }
@ -3062,10 +3070,11 @@ bool cmGlobalXCodeGenerator::CreateGroups(cmLocalGenerator* root,
} }
cmMakefile* mf = (*i)->GetMakefile(); cmMakefile* mf = (*i)->GetMakefile();
std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups(); std::vector<cmSourceGroup> sourceGroups = mf->GetSourceGroups();
cmTargets &tgts = mf->GetTargets(); std::vector<cmGeneratorTarget*> tgts = (*i)->GetGeneratorTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++)
{ {
cmTarget& cmtarget = l->second; cmTarget& cmtarget = *(*l)->Target;
// Same skipping logic here as in CreateXCodeTargets so that we do not // Same skipping logic here as in CreateXCodeTargets so that we do not
// end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source // end up with (empty anyhow) ALL_BUILD and XCODE_DEPEND_HELPER source

View File

@ -2510,28 +2510,29 @@ cmLocalGenerator
{ {
// Convert the old-style install specification from each target to // Convert the old-style install specification from each target to
// an install generator and run it. // an install generator and run it.
cmTargets& tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l)
{ {
if (l->second.GetType() == cmState::INTERFACE_LIBRARY) if ((*l)->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
// Include the user-specified pre-install script for this target. // Include the user-specified pre-install script for this target.
if(const char* preinstall = l->second.GetProperty("PRE_INSTALL_SCRIPT")) if(const char* preinstall = (*l)->GetProperty("PRE_INSTALL_SCRIPT"))
{ {
cmInstallScriptGenerator g(preinstall, false, 0); cmInstallScriptGenerator g(preinstall, false, 0);
g.Generate(os, config, configurationTypes); g.Generate(os, config, configurationTypes);
} }
// Install this target if a destination is given. // Install this target if a destination is given.
if(l->second.GetInstallPath() != "") if((*l)->Target->GetInstallPath() != "")
{ {
// Compute the full install destination. Note that converting // Compute the full install destination. Note that converting
// to unix slashes also removes any trailing slash. // to unix slashes also removes any trailing slash.
// We also skip over the leading slash given by the user. // We also skip over the leading slash given by the user.
std::string destination = l->second.GetInstallPath().substr(1); std::string destination = (*l)->Target->GetInstallPath().substr(1);
cmSystemTools::ConvertToUnixSlashes(destination); cmSystemTools::ConvertToUnixSlashes(destination);
if(destination.empty()) if(destination.empty())
{ {
@ -2539,7 +2540,7 @@ cmLocalGenerator
} }
// Generate the proper install generator for this target type. // Generate the proper install generator for this target type.
switch(l->second.GetType()) switch((*l)->GetType())
{ {
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
@ -2547,7 +2548,7 @@ cmLocalGenerator
{ {
// Use a target install generator. // Use a target install generator.
cmInstallTargetGeneratorLocal cmInstallTargetGeneratorLocal
g(this, l->first, destination.c_str(), false); g(this, (*l)->GetName(), destination.c_str(), false);
g.Generate(os, config, configurationTypes); g.Generate(os, config, configurationTypes);
} }
break; break;
@ -2558,18 +2559,18 @@ cmLocalGenerator
// to the normal destination and the DLL to the runtime // to the normal destination and the DLL to the runtime
// destination. // destination.
cmInstallTargetGeneratorLocal cmInstallTargetGeneratorLocal
g1(this, l->first, destination.c_str(), true); g1(this, (*l)->GetName(), destination.c_str(), true);
g1.Generate(os, config, configurationTypes); g1.Generate(os, config, configurationTypes);
// We also skip over the leading slash given by the user. // We also skip over the leading slash given by the user.
destination = l->second.GetRuntimeInstallPath().substr(1); destination = (*l)->Target->GetRuntimeInstallPath().substr(1);
cmSystemTools::ConvertToUnixSlashes(destination); cmSystemTools::ConvertToUnixSlashes(destination);
cmInstallTargetGeneratorLocal cmInstallTargetGeneratorLocal
g2(this, l->first, destination.c_str(), false); g2(this, (*l)->GetName(), destination.c_str(), false);
g2.Generate(os, config, configurationTypes); g2.Generate(os, config, configurationTypes);
#else #else
// Use a target install generator. // Use a target install generator.
cmInstallTargetGeneratorLocal cmInstallTargetGeneratorLocal
g(this, l->first, destination.c_str(), false); g(this, (*l)->GetName(), destination.c_str(), false);
g.Generate(os, config, configurationTypes); g.Generate(os, config, configurationTypes);
#endif #endif
} }
@ -2580,7 +2581,7 @@ cmLocalGenerator
} }
// Include the user-specified post-install script for this target. // Include the user-specified post-install script for this target.
if(const char* postinstall = l->second.GetProperty("POST_INSTALL_SCRIPT")) if(const char* postinstall = (*l)->GetProperty("POST_INSTALL_SCRIPT"))
{ {
cmInstallScriptGenerator g(postinstall, false, 0); cmInstallScriptGenerator g(postinstall, false, 0);
g.Generate(os, config, configurationTypes); g.Generate(os, config, configurationTypes);

View File

@ -1762,43 +1762,43 @@ void cmLocalUnixMakefileGenerator3
ruleFileStream ruleFileStream
<< "# Targets provided globally by CMake.\n" << "# Targets provided globally by CMake.\n"
<< "\n"; << "\n";
cmTargets* targets = &(this->Makefile->GetTargets()); std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets();
cmTargets::iterator glIt; std::vector<cmGeneratorTarget*>::iterator glIt;
for ( glIt = targets->begin(); glIt != targets->end(); ++ glIt ) for ( glIt = targets.begin(); glIt != targets.end(); ++ glIt )
{ {
if ( glIt->second.GetType() == cmState::GLOBAL_TARGET ) if ( (*glIt)->GetType() == cmState::GLOBAL_TARGET )
{ {
std::string targetString = "Special rule for the target " + glIt->first; std::string targetString = "Special rule for the target " +
(*glIt)->GetName();
std::vector<std::string> commands; std::vector<std::string> commands;
std::vector<std::string> depends; std::vector<std::string> depends;
const char* text = glIt->second.GetProperty("EchoString"); const char* text = (*glIt)->GetProperty("EchoString");
if ( !text ) if ( !text )
{ {
text = "Running external command ..."; text = "Running external command ...";
} }
depends.insert(depends.end(), glIt->second.GetUtilities().begin(), depends.insert(depends.end(), (*glIt)->Target->GetUtilities().begin(),
glIt->second.GetUtilities().end()); (*glIt)->Target->GetUtilities().end());
this->AppendEcho(commands, text, this->AppendEcho(commands, text,
cmLocalUnixMakefileGenerator3::EchoGlobal); cmLocalUnixMakefileGenerator3::EchoGlobal);
cmGeneratorTarget* gt = this->GlobalGenerator cmGeneratorTarget* gt = *glIt;
->GetGeneratorTarget(&glIt->second);
// Global targets store their rules in pre- and post-build commands. // Global targets store their rules in pre- and post-build commands.
this->AppendCustomDepends(depends, this->AppendCustomDepends(depends,
glIt->second.GetPreBuildCommands()); gt->Target->GetPreBuildCommands());
this->AppendCustomDepends(depends, this->AppendCustomDepends(depends,
glIt->second.GetPostBuildCommands()); gt->Target->GetPostBuildCommands());
this->AppendCustomCommands(commands, this->AppendCustomCommands(commands,
glIt->second.GetPreBuildCommands(), gt->Target->GetPreBuildCommands(),
gt, gt,
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
this->AppendCustomCommands(commands, this->AppendCustomCommands(commands,
glIt->second.GetPostBuildCommands(), gt->Target->GetPostBuildCommands(),
gt, gt,
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
std::string targetName = glIt->second.GetName(); std::string targetName = gt->GetName();
this->WriteMakeRule(ruleFileStream, targetString.c_str(), this->WriteMakeRule(ruleFileStream, targetString.c_str(),
targetName, depends, commands, true); targetName, depends, commands, true);

View File

@ -74,22 +74,23 @@ cmLocalVisualStudio10Generator::~cmLocalVisualStudio10Generator()
void cmLocalVisualStudio10Generator::Generate() void cmLocalVisualStudio10Generator::Generate()
{ {
cmTargets &tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l)
{ {
if(l->second.GetType() == cmState::INTERFACE_LIBRARY) if((*l)->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator) if(static_cast<cmGlobalVisualStudioGenerator*>(this->GlobalGenerator)
->TargetIsFortranOnly(l->second)) ->TargetIsFortranOnly(*(*l)->Target))
{ {
this->CreateSingleVCProj(l->first.c_str(),l->second); this->CreateSingleVCProj((*l)->GetName().c_str(), *(*l)->Target);
} }
else else
{ {
cmVisualStudio10TargetGenerator tg( cmVisualStudio10TargetGenerator tg(
&l->second, static_cast<cmGlobalVisualStudio10Generator*>( (*l)->Target, static_cast<cmGlobalVisualStudio10Generator*>(
this->GetGlobalGenerator())); this->GetGlobalGenerator()));
tg.Generate(); tg.Generate();
} }

View File

@ -82,12 +82,12 @@ private:
void cmLocalVisualStudio6Generator::AddCMakeListsRules() void cmLocalVisualStudio6Generator::AddCMakeListsRules()
{ {
cmTargets &tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(cmTargets::iterator l = tgts.begin(); for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++) l != tgts.end(); ++l)
{ {
if (l->second.GetType() == cmState::INTERFACE_LIBRARY if ((*l)->GetType() == cmState::INTERFACE_LIBRARY
|| l->second.GetType() == cmState::GLOBAL_TARGET) || (*l)->GetType() == cmState::GLOBAL_TARGET)
{ {
continue; continue;
} }
@ -98,7 +98,7 @@ void cmLocalVisualStudio6Generator::AddCMakeListsRules()
this->Makefile->GetDefinition("CMAKE_SUPPRESS_REGENERATION"); this->Makefile->GetDefinition("CMAKE_SUPPRESS_REGENERATION");
if (!cmSystemTools::IsOn(suppRegenRule)) if (!cmSystemTools::IsOn(suppRegenRule))
{ {
this->AddDSPBuildRule(l->second); this->AddDSPBuildRule(*(*l)->Target);
} }
} }
} }
@ -124,54 +124,56 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
// Create the DSP or set of DSP's for libraries and executables // Create the DSP or set of DSP's for libraries and executables
cmTargets &tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
// build any targets l != tgts.end(); ++l)
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{ {
switch(l->second.GetType()) switch((*l)->GetType())
{ {
case cmState::STATIC_LIBRARY: case cmState::STATIC_LIBRARY:
case cmState::OBJECT_LIBRARY: case cmState::OBJECT_LIBRARY:
this->SetBuildType(STATIC_LIBRARY, l->first.c_str(), l->second); this->SetBuildType(STATIC_LIBRARY,
(*l)->GetName().c_str(), *(*l)->Target);
break; break;
case cmState::SHARED_LIBRARY: case cmState::SHARED_LIBRARY:
case cmState::MODULE_LIBRARY: case cmState::MODULE_LIBRARY:
this->SetBuildType(DLL, l->first.c_str(), l->second); this->SetBuildType(DLL,
(*l)->GetName().c_str(), *(*l)->Target);
break; break;
case cmState::EXECUTABLE: case cmState::EXECUTABLE:
this->SetBuildType(EXECUTABLE,l->first.c_str(), l->second); this->SetBuildType(EXECUTABLE,
(*l)->GetName().c_str(), *(*l)->Target);
break; break;
case cmState::UTILITY: case cmState::UTILITY:
case cmState::GLOBAL_TARGET: case cmState::GLOBAL_TARGET:
this->SetBuildType(UTILITY, l->first.c_str(), l->second); this->SetBuildType(UTILITY,
(*l)->GetName().c_str(), *(*l)->Target);
break; break;
case cmState::INTERFACE_LIBRARY: case cmState::INTERFACE_LIBRARY:
continue; continue;
default: default:
cmSystemTools::Error("Bad target type: ", l->first.c_str()); cmSystemTools::Error("Bad target type: ", (*l)->GetName().c_str());
break; break;
} }
// INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
// so don't build a projectfile for it // so don't build a projectfile for it
const char* path = const char* path =
l->second.GetProperty("EXTERNAL_MSPROJECT"); (*l)->GetProperty("EXTERNAL_MSPROJECT");
if(!path) if(!path)
{ {
// check to see if the dsp is going into a sub-directory // check to see if the dsp is going into a sub-directory
std::string::size_type pos = l->first.rfind('/'); std::string::size_type pos = (*l)->GetName().rfind('/');
if(pos != std::string::npos) if(pos != std::string::npos)
{ {
std::string dir = this->GetCurrentBinaryDirectory(); std::string dir = this->GetCurrentBinaryDirectory();
dir += "/"; dir += "/";
dir += l->first.substr(0, pos); dir += (*l)->GetName().substr(0, pos);
if(!cmSystemTools::MakeDirectory(dir.c_str())) if(!cmSystemTools::MakeDirectory(dir.c_str()))
{ {
cmSystemTools::Error("Error creating directory: ", dir.c_str()); cmSystemTools::Error("Error creating directory: ", dir.c_str());
} }
} }
this->CreateSingleDSP(l->first.c_str(),l->second); this->CreateSingleDSP((*l)->GetName().c_str(), *(*l)->Target);
} }
} }
} }

View File

@ -67,19 +67,19 @@ cmLocalVisualStudio7Generator::~cmLocalVisualStudio7Generator()
void cmLocalVisualStudio7Generator::AddHelperCommands() void cmLocalVisualStudio7Generator::AddHelperCommands()
{ {
// Now create GUIDs for targets // Now create GUIDs for targets
cmTargets &tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) l != tgts.end(); ++l)
{ {
if(l->second.GetType() == cmState::INTERFACE_LIBRARY) if((*l)->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
const char* path = l->second.GetProperty("EXTERNAL_MSPROJECT"); const char* path = (*l)->GetProperty("EXTERNAL_MSPROJECT");
if(path) if(path)
{ {
this->ReadAndStoreExternalGUID( this->ReadAndStoreExternalGUID(
l->second.GetName().c_str(), path); (*l)->GetName().c_str(), path);
} }
} }
@ -95,7 +95,6 @@ void cmLocalVisualStudio7Generator::Generate()
void cmLocalVisualStudio7Generator::AddCMakeListsRules() void cmLocalVisualStudio7Generator::AddCMakeListsRules()
{ {
cmTargets &tgts = this->Makefile->GetTargets();
// Create the regeneration custom rule. // Create the regeneration custom rule.
if(!this->Makefile->IsOn("CMAKE_SUPPRESS_REGENERATION")) if(!this->Makefile->IsOn("CMAKE_SUPPRESS_REGENERATION"))
{ {
@ -104,17 +103,17 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules()
if(cmSourceFile* sf = this->CreateVCProjBuildRule()) if(cmSourceFile* sf = this->CreateVCProjBuildRule())
{ {
// Add the rule to targets that need it. // Add the rule to targets that need it.
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); ++l)
{ {
if (l->second.GetType() == cmState::GLOBAL_TARGET) if ((*l)->GetType() == cmState::GLOBAL_TARGET)
{ {
continue; continue;
} }
if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET) if((*l)->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET)
{ {
cmGeneratorTarget* gt = (*l)->AddSource(sf->GetFullPath());
this->GlobalGenerator->GetGeneratorTarget(&l->second);
gt->AddSource(sf->GetFullPath());
} }
} }
} }
@ -126,11 +125,11 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
// Visual Studio .NET 2003 Service Pack 1 will not run post-build // Visual Studio .NET 2003 Service Pack 1 will not run post-build
// commands for targets in which no sources are built. Add dummy // commands for targets in which no sources are built. Add dummy
// rules to force these targets to build. // rules to force these targets to build.
cmTargets &tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
for(cmTargets::iterator l = tgts.begin(); for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++) l != tgts.end(); l++)
{ {
cmTarget& tgt = l->second; cmTarget& tgt = *(*l)->Target;
if(tgt.GetType() == cmState::GLOBAL_TARGET) if(tgt.GetType() == cmState::GLOBAL_TARGET)
{ {
std::vector<std::string> no_depends; std::vector<std::string> no_depends;
@ -150,9 +149,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
force.c_str(), no_depends, no_main_dependency, force.c_str(), no_depends, no_main_dependency,
force_commands, " ", 0, true)) force_commands, " ", 0, true))
{ {
cmGeneratorTarget* gt = (*l)->AddSource(file->GetFullPath());
this->GlobalGenerator->GetGeneratorTarget(&tgt);
gt->AddSource(file->GetFullPath());
} }
} }
} }
@ -176,21 +173,21 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
} }
// Get the set of targets in this directory. // Get the set of targets in this directory.
cmTargets &tgts = this->Makefile->GetTargets(); std::vector<cmGeneratorTarget*> tgts = this->GetGeneratorTargets();
// Create the project file for each target. // Create the project file for each target.
for(cmTargets::iterator l = tgts.begin(); for(std::vector<cmGeneratorTarget*>::iterator l = tgts.begin();
l != tgts.end(); l++) l != tgts.end(); l++)
{ {
if(l->second.GetType() == cmState::INTERFACE_LIBRARY) if((*l)->GetType() == cmState::INTERFACE_LIBRARY)
{ {
continue; continue;
} }
// INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
// so don't build a projectfile for it // so don't build a projectfile for it
if(!l->second.GetProperty("EXTERNAL_MSPROJECT")) if(!(*l)->GetProperty("EXTERNAL_MSPROJECT"))
{ {
this->CreateSingleVCProj(l->first.c_str(),l->second); this->CreateSingleVCProj((*l)->GetName().c_str(), *(*l)->Target);
} }
} }
} }