cmLocalGenerator: Store cmGeneratorTargets.
Relieve cmMakefile of this responsibility.
This commit is contained in:
parent
488723f5cd
commit
2293d43d00
|
@ -43,7 +43,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
|
|||
{
|
||||
std::string const& argv0 = this->CC.GetCommandLines()[c][0];
|
||||
cmGeneratorTarget* target =
|
||||
this->LG->GetMakefile()->FindGeneratorTargetToUse(argv0);
|
||||
this->LG->FindGeneratorTargetToUse(argv0);
|
||||
if(target && target->GetType() == cmTarget::EXECUTABLE &&
|
||||
(target->Target->IsImported()
|
||||
|| !this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING")))
|
||||
|
|
|
@ -42,7 +42,7 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
|
|||
tei = targets.begin();
|
||||
tei != targets.end(); ++tei)
|
||||
{
|
||||
cmGeneratorTarget *te = this->LG->GetMakefile()
|
||||
cmGeneratorTarget *te = this->LG
|
||||
->FindGeneratorTargetToUse(*tei);
|
||||
expectedTargets += sep + this->Namespace + te->Target->GetExportName();
|
||||
sep = " ";
|
||||
|
|
|
@ -965,8 +965,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
|
|||
it != this->GlobalGenerator->GetLocalGenerators().end();
|
||||
++it)
|
||||
{
|
||||
cmGeneratorTargetsType targets = (*it)->GetMakefile()
|
||||
->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType targets = (*it)->GetGeneratorTargets();
|
||||
for (cmGeneratorTargetsType::iterator l = targets.begin();
|
||||
l != targets.end(); ++l)
|
||||
{
|
||||
|
|
|
@ -1275,7 +1275,7 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
|
|||
|
||||
std::string tgtName = parameters.front();
|
||||
cmGeneratorTarget* gt =
|
||||
context->LG->GetMakefile()->FindGeneratorTargetToUse(tgtName);
|
||||
context->LG->FindGeneratorTargetToUse(tgtName);
|
||||
if (!gt)
|
||||
{
|
||||
std::ostringstream e;
|
||||
|
@ -1739,7 +1739,7 @@ struct TargetFilesystemArtifact : public cmGeneratorExpressionNode
|
|||
return std::string();
|
||||
}
|
||||
cmGeneratorTarget* target =
|
||||
context->LG->GetMakefile()->FindGeneratorTargetToUse(name);
|
||||
context->LG->FindGeneratorTargetToUse(name);
|
||||
if(!target)
|
||||
{
|
||||
::reportError(context, content->GetOriginalExpression(),
|
||||
|
|
|
@ -2305,7 +2305,8 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
|
|||
|
||||
// Check for a target with this name.
|
||||
if(cmGeneratorTarget* t
|
||||
= this->Makefile->FindGeneratorTargetToUse(util))
|
||||
= this->GeneratorTarget->
|
||||
GetLocalGenerator()->FindGeneratorTargetToUse(util))
|
||||
{
|
||||
// If we find the target and the dep was given as a full path,
|
||||
// then make sure it was not a full path to something else, and
|
||||
|
|
|
@ -1578,7 +1578,7 @@ void cmGlobalGenerator::CreateGeneratorTargets(TargetTypes targetTypes,
|
|||
this->GeneratorTargets[*j] = gt;
|
||||
generatorTargets[*j] = gt;
|
||||
}
|
||||
mf->SetGeneratorTargets(generatorTargets);
|
||||
lg->SetGeneratorTargets(generatorTargets);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -287,7 +287,7 @@ void cmGlobalGhsMultiGenerator::Generate()
|
|||
{
|
||||
cmLocalGhsMultiGenerator *lg =
|
||||
static_cast<cmLocalGhsMultiGenerator *>(this->LocalGenerators[i]);
|
||||
cmGeneratorTargetsType tgts = lg->GetMakefile()->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType tgts = lg->GetGeneratorTargets();
|
||||
this->UpdateBuildFiles(&tgts);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,8 +68,7 @@ void cmGlobalKdevelopGenerator::Generate()
|
|||
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
|
||||
lg!=lgs.end(); lg++)
|
||||
{
|
||||
cmMakefile* makefile=(*lg)->GetMakefile();
|
||||
cmGeneratorTargetsType const& targets = makefile->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType const& targets = (*lg)->GetGeneratorTargets();
|
||||
for (cmGeneratorTargetsType::const_iterator ti = targets.begin();
|
||||
ti != targets.end(); ti++)
|
||||
{
|
||||
|
|
|
@ -461,7 +461,7 @@ cmGlobalUnixMakefileGenerator3
|
|||
// The directory-level rule should depend on the target-level rules
|
||||
// for all targets in the directory.
|
||||
std::vector<std::string> depends;
|
||||
cmGeneratorTargetsType targets = lg->GetMakefile()->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType targets = lg->GetGeneratorTargets();
|
||||
for(cmGeneratorTargetsType::iterator l = targets.begin();
|
||||
l != targets.end(); ++l)
|
||||
{
|
||||
|
@ -627,7 +627,7 @@ cmGlobalUnixMakefileGenerator3
|
|||
lg = static_cast<cmLocalUnixMakefileGenerator3 *>
|
||||
(this->LocalGenerators[i]);
|
||||
// for each target Generate the rule files for each target.
|
||||
cmGeneratorTargetsType targets = lg->GetMakefile()->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType targets = lg->GetGeneratorTargets();
|
||||
for(cmGeneratorTargetsType::iterator t = targets.begin();
|
||||
t != targets.end(); ++t)
|
||||
{
|
||||
|
@ -728,7 +728,7 @@ cmGlobalUnixMakefileGenerator3
|
|||
depends.push_back("cmake_check_build_system");
|
||||
|
||||
// for each target Generate the rule files for each target.
|
||||
cmGeneratorTargetsType targets = lg->GetMakefile()->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType targets = lg->GetGeneratorTargets();
|
||||
for(cmGeneratorTargetsType::iterator t = targets.begin();
|
||||
t != targets.end(); ++t)
|
||||
{
|
||||
|
|
|
@ -256,7 +256,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
|
|||
noCommandLines);
|
||||
|
||||
cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg);
|
||||
mf->AddGeneratorTarget(tgt, gt);
|
||||
lg->AddGeneratorTarget(tgt, gt);
|
||||
|
||||
// Organize in the "predefined targets" folder:
|
||||
//
|
||||
|
|
|
@ -87,7 +87,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
|
|||
"Build all projects");
|
||||
|
||||
cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]);
|
||||
allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt);
|
||||
gen[0]->AddGeneratorTarget(allBuild, gt);
|
||||
|
||||
#if 0
|
||||
// Can't activate this code because we want ALL_BUILD
|
||||
|
@ -108,7 +108,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
|
|||
i != gen.end(); ++i)
|
||||
{
|
||||
cmGeneratorTargetsType targets =
|
||||
(*i)->GetMakefile()->GetGeneratorTargets();
|
||||
(*i)->GetGeneratorTargets();
|
||||
for(cmGeneratorTargetsType::iterator t = targets.begin();
|
||||
t != targets.end(); ++t)
|
||||
{
|
||||
|
|
|
@ -459,7 +459,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
|||
"echo", "Build all projects");
|
||||
|
||||
cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root);
|
||||
mf->AddGeneratorTarget(allbuild, allBuildGt);
|
||||
root->AddGeneratorTarget(allbuild, allBuildGt);
|
||||
|
||||
// Refer to the main build configuration file for easy editing.
|
||||
std::string listfile = root->GetCurrentSourceDirectory();
|
||||
|
@ -494,7 +494,7 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root,
|
|||
"make", "-f", file.c_str());
|
||||
|
||||
cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root);
|
||||
mf->AddGeneratorTarget(check, checkGt);
|
||||
root->AddGeneratorTarget(check, checkGt);
|
||||
}
|
||||
|
||||
// now make the allbuild depend on all the non-utility targets
|
||||
|
|
|
@ -132,7 +132,7 @@ void cmLocalGenerator::TraceDependencies()
|
|||
this->GlobalGenerator->CreateEvaluationSourceFiles(*ci);
|
||||
}
|
||||
// Generate the rule files for each target.
|
||||
cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType targets = this->GetGeneratorTargets();
|
||||
for(cmGeneratorTargetsType::iterator t = targets.begin();
|
||||
t != targets.end(); ++t)
|
||||
{
|
||||
|
@ -448,6 +448,13 @@ void cmLocalGenerator::GenerateInstallRules()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void cmLocalGenerator::AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt)
|
||||
{
|
||||
this->GeneratorTargets[t] = gt;
|
||||
this->GetGlobalGenerator()->AddGeneratorTarget(t, gt);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmLocalGenerator::ComputeTargetManifest()
|
||||
{
|
||||
|
@ -460,7 +467,7 @@ void cmLocalGenerator::ComputeTargetManifest()
|
|||
}
|
||||
|
||||
// Add our targets to the manifest for each configuration.
|
||||
cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType targets = this->GetGeneratorTargets();
|
||||
for(cmGeneratorTargetsType::iterator t = targets.begin();
|
||||
t != targets.end(); ++t)
|
||||
{
|
||||
|
@ -1766,6 +1773,17 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
|
|||
this->AddConfigVariableFlags(flags, flagsVar, config);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
cmGeneratorTarget*
|
||||
cmLocalGenerator::FindGeneratorTargetToUse(const std::string& name) const
|
||||
{
|
||||
if (cmTarget *t = this->Makefile->FindTargetToUse(name))
|
||||
{
|
||||
return this->GetGlobalGenerator()->GetGeneratorTarget(t);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmLocalGenerator::GetRealDependency(const std::string& inName,
|
||||
const std::string& config,
|
||||
|
@ -1792,7 +1810,7 @@ bool cmLocalGenerator::GetRealDependency(const std::string& inName,
|
|||
|
||||
// Look for a CMake target with the given name.
|
||||
if(cmGeneratorTarget* target =
|
||||
this->Makefile->FindGeneratorTargetToUse(name))
|
||||
this->FindGeneratorTargetToUse(name))
|
||||
{
|
||||
// make sure it is not just a coincidence that the target name
|
||||
// found is part of the inName
|
||||
|
|
|
@ -112,6 +112,19 @@ public:
|
|||
bool forResponseFile = false,
|
||||
const std::string& config = "");
|
||||
|
||||
const cmGeneratorTargetsType &GetGeneratorTargets() const
|
||||
{
|
||||
return this->GeneratorTargets;
|
||||
}
|
||||
|
||||
void SetGeneratorTargets(const cmGeneratorTargetsType &targets)
|
||||
{
|
||||
this->GeneratorTargets = targets;
|
||||
}
|
||||
void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt);
|
||||
|
||||
cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;
|
||||
|
||||
/**
|
||||
* Encode a list of preprocessor definitions for the compiler
|
||||
* command line.
|
||||
|
@ -354,6 +367,7 @@ protected:
|
|||
std::set<std::string> ObjectMaxPathViolations;
|
||||
|
||||
std::set<cmTarget const*> WarnCMP0063;
|
||||
cmGeneratorTargetsType GeneratorTargets;
|
||||
|
||||
bool EmitUniversalBinaryFlags;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() {}
|
|||
|
||||
void cmLocalGhsMultiGenerator::Generate()
|
||||
{
|
||||
cmGeneratorTargetsType tgts = this->GetMakefile()->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType tgts = this->GetGeneratorTargets();
|
||||
|
||||
for (cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end();
|
||||
++l)
|
||||
|
|
|
@ -73,7 +73,7 @@ void cmLocalNinjaGenerator::Generate()
|
|||
}
|
||||
}
|
||||
|
||||
cmGeneratorTargetsType targets = this->GetMakefile()->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType targets = this->GetGeneratorTargets();
|
||||
for(cmGeneratorTargetsType::iterator t = targets.begin();
|
||||
t != targets.end(); ++t)
|
||||
{
|
||||
|
|
|
@ -113,7 +113,7 @@ void cmLocalUnixMakefileGenerator3::Generate()
|
|||
this->Makefile->IsOn("CMAKE_SKIP_ASSEMBLY_SOURCE_RULES");
|
||||
|
||||
// Generate the rule files for each target.
|
||||
cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType targets = this->GetGeneratorTargets();
|
||||
cmGlobalUnixMakefileGenerator3* gg =
|
||||
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
|
||||
for(cmGeneratorTargetsType::iterator t = targets.begin();
|
||||
|
@ -175,7 +175,7 @@ void cmLocalUnixMakefileGenerator3::
|
|||
GetLocalObjectFiles(std::map<std::string, LocalObjectInfo> &localObjectFiles)
|
||||
{
|
||||
std::set<std::string> emitted;
|
||||
cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType targets = this->GetGeneratorTargets();
|
||||
for(cmGeneratorTargetsType::iterator ti = targets.begin();
|
||||
ti != targets.end(); ++ti)
|
||||
{
|
||||
|
@ -418,7 +418,7 @@ void cmLocalUnixMakefileGenerator3
|
|||
|
||||
// for each target we just provide a rule to cd up to the top and do a make
|
||||
// on the target
|
||||
cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
|
||||
cmGeneratorTargetsType targets = this->GetGeneratorTargets();
|
||||
std::string localName;
|
||||
for(cmGeneratorTargetsType::iterator t = targets.begin();
|
||||
t != targets.end(); ++t)
|
||||
|
|
|
@ -1812,12 +1812,6 @@ const char* cmMakefile::GetCurrentBinaryDirectory() const
|
|||
return this->StateSnapshot.GetDirectory().GetCurrentBinary();
|
||||
}
|
||||
|
||||
void cmMakefile::AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt)
|
||||
{
|
||||
this->GeneratorTargets[t] = gt;
|
||||
this->GetGlobalGenerator()->AddGeneratorTarget(t, gt);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
|
||||
bool before)
|
||||
|
@ -4320,17 +4314,6 @@ bool cmMakefile::IsAlias(const std::string& name) const
|
|||
return this->GetGlobalGenerator()->IsAlias(name);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
cmGeneratorTarget*
|
||||
cmMakefile::FindGeneratorTargetToUse(const std::string& name) const
|
||||
{
|
||||
if (cmTarget *t = this->FindTargetToUse(name))
|
||||
{
|
||||
return this->GetGlobalGenerator()->GetGeneratorTarget(t);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
|
||||
bool isCustom) const
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "cmSystemTools.h"
|
||||
#include "cmTarget.h"
|
||||
#include "cmNewLineStyle.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmExpandedCommandArgument.h"
|
||||
#include "cmake.h"
|
||||
#include "cmState.h"
|
||||
|
@ -393,17 +392,6 @@ public:
|
|||
return this->ImportedTargetsOwned;
|
||||
}
|
||||
|
||||
const cmGeneratorTargetsType &GetGeneratorTargets() const
|
||||
{
|
||||
return this->GeneratorTargets;
|
||||
}
|
||||
|
||||
void SetGeneratorTargets(const cmGeneratorTargetsType &targets)
|
||||
{
|
||||
this->GeneratorTargets = targets;
|
||||
}
|
||||
void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt);
|
||||
|
||||
cmTarget* FindTarget(const std::string& name,
|
||||
bool excludeAliases = false) const;
|
||||
|
||||
|
@ -412,7 +400,6 @@ public:
|
|||
cmTarget* FindTargetToUse(const std::string& name,
|
||||
bool excludeAliases = false) const;
|
||||
bool IsAlias(const std::string& name) const;
|
||||
cmGeneratorTarget* FindGeneratorTargetToUse(const std::string& name) const;
|
||||
|
||||
/**
|
||||
* Mark include directories as system directories.
|
||||
|
@ -816,7 +803,6 @@ protected:
|
|||
typedef std::map<std::string, cmTarget*> TargetMap;
|
||||
#endif
|
||||
TargetMap AliasTargets;
|
||||
cmGeneratorTargetsType GeneratorTargets;
|
||||
std::vector<cmSourceFile*> SourceFiles;
|
||||
|
||||
// Tests
|
||||
|
|
|
@ -886,7 +886,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
|
|||
commandLines, false, autogenComment.c_str());
|
||||
|
||||
cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg);
|
||||
makefile->AddGeneratorTarget(autogenTarget, gt);
|
||||
lg->AddGeneratorTarget(autogenTarget, gt);
|
||||
|
||||
// Set target folder
|
||||
const char* autogenFolder = makefile->GetState()
|
||||
|
|
|
@ -89,7 +89,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
|
|||
// be translated.
|
||||
std::string exe = command[0];
|
||||
cmGeneratorTarget* target =
|
||||
this->LG->GetMakefile()->FindGeneratorTargetToUse(exe);
|
||||
this->LG->FindGeneratorTargetToUse(exe);
|
||||
if(target && target->GetType() == cmTarget::EXECUTABLE)
|
||||
{
|
||||
// Use the target file on disk.
|
||||
|
|
Loading…
Reference in New Issue