Access sources through cmGeneratorTarget.

This commit is contained in:
Stephen Kelly 2015-08-29 17:51:15 +02:00
parent 7ce0991a7a
commit 5d3776a7eb
12 changed files with 27 additions and 16 deletions

View File

@ -401,7 +401,9 @@ void cmExtraCodeBlocksGenerator
case cmTarget::UTILITY: // can have sources since 2.6.3 case cmTarget::UTILITY: // can have sources since 2.6.3
{ {
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
ti->second.GetSourceFiles(sources, cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&ti->second);
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();
si!=sources.end(); si++) si!=sources.end(); si++)

View File

@ -196,7 +196,9 @@ void cmExtraCodeLiteGenerator
case cmTarget::MODULE_LIBRARY: case cmTarget::MODULE_LIBRARY:
{ {
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
ti->second.GetSourceFiles(sources, cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&ti->second);
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();
si!=sources.end(); si++) si!=sources.end(); si++)

View File

@ -562,7 +562,9 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(
// 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); cmTarget* tgt = const_cast<cmTarget*>(&ti->second);
std::vector<cmSourceFile*> files; std::vector<cmSourceFile*> files;
tgt->GetSourceFiles(files, cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(tgt);
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();
sfIt != files.end(); sfIt != files.end();

View File

@ -237,7 +237,7 @@ void cmExtraSublimeTextGenerator::
cmGeneratorTarget *gtgt = this->GlobalGenerator cmGeneratorTarget *gtgt = this->GlobalGenerator
->GetGeneratorTarget(target); ->GetGeneratorTarget(target);
std::vector<cmSourceFile*> sourceFiles; std::vector<cmSourceFile*> sourceFiles;
target->GetSourceFiles(sourceFiles, gtgt->GetSourceFiles(sourceFiles,
makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
std::vector<cmSourceFile*>::const_iterator sourceFilesEnd = std::vector<cmSourceFile*>::const_iterator sourceFilesEnd =
sourceFiles.end(); sourceFiles.end();

View File

@ -449,7 +449,7 @@ static void handleSystemIncludesDep(cmMakefile *mf, cmTarget const* depTgt,
#define IMPLEMENT_VISIT_IMPL(DATA, DATATYPE) \ #define IMPLEMENT_VISIT_IMPL(DATA, DATATYPE) \
{ \ { \
std::vector<cmSourceFile*> sourceFiles; \ std::vector<cmSourceFile*> sourceFiles; \
this->Target->GetSourceFiles(sourceFiles, config); \ this->GetSourceFiles(sourceFiles, config); \
TagVisitor<DATA ## Tag DATATYPE> visitor(this, data); \ TagVisitor<DATA ## Tag DATATYPE> visitor(this, data); \
for(std::vector<cmSourceFile*>::const_iterator si = sourceFiles.begin(); \ for(std::vector<cmSourceFile*>::const_iterator si = sourceFiles.begin(); \
si != sourceFiles.end(); ++si) \ si != sourceFiles.end(); ++si) \
@ -1683,7 +1683,7 @@ cmTargetTraceDependencies
ci != configs.end(); ++ci) ci != configs.end(); ++ci)
{ {
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
this->Target->GetSourceFiles(sources, *ci); this->GeneratorTarget->GetSourceFiles(sources, *ci);
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)
{ {
@ -4444,12 +4444,12 @@ bool cmGeneratorTarget::GetConfigCommonSourceFiles(
std::vector<std::string>::const_iterator it = configs.begin(); std::vector<std::string>::const_iterator it = configs.begin();
const std::string& firstConfig = *it; const std::string& firstConfig = *it;
this->Target->GetSourceFiles(files, firstConfig); this->GetSourceFiles(files, firstConfig);
for ( ; it != configs.end(); ++it) for ( ; it != configs.end(); ++it)
{ {
std::vector<cmSourceFile*> configFiles; std::vector<cmSourceFile*> configFiles;
this->Target->GetSourceFiles(configFiles, *it); this->GetSourceFiles(configFiles, *it);
if (configFiles != files) if (configFiles != files)
{ {
std::string firstConfigFiles; std::string firstConfigFiles;

View File

@ -172,7 +172,7 @@ std::vector<cmSourceFile *> cmGhsMultiTargetGenerator::GetSources() const
{ {
std::vector<cmSourceFile *> output; std::vector<cmSourceFile *> output;
std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); std::string config = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->Target->GetSourceFiles(output, config); this->GeneratorTarget->GetSourceFiles(output, config);
return output; return output;
} }
@ -574,7 +574,7 @@ bool cmGhsMultiTargetGenerator::DetermineIfTargetGroup(
std::vector<cmSourceFile *> sources; std::vector<cmSourceFile *> sources;
std::string config = std::string config =
target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); target->Target->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
target->Target->GetSourceFiles(sources, config); target->GetSourceFiles(sources, config);
for (std::vector<cmSourceFile *>::const_iterator sources_i = sources.begin(); for (std::vector<cmSourceFile *>::const_iterator sources_i = sources.begin();
sources.end() != sources_i; ++sources_i) sources.end() != sources_i; ++sources_i)
{ {

View File

@ -2949,10 +2949,12 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target)
{ {
configs.push_back(""); configs.push_back("");
} }
cmGeneratorTarget* gt =
this->GetGeneratorTarget(target);
for(std::vector<std::string>::const_iterator ci = configs.begin(); for(std::vector<std::string>::const_iterator ci = configs.begin();
ci != configs.end(); ++ci) ci != configs.end(); ++ci)
{ {
target->GetSourceFiles(sources, *ci); gt->GetSourceFiles(sources, *ci);
} }
std::vector<cmSourceFile*>::const_iterator sourcesEnd std::vector<cmSourceFile*>::const_iterator sourcesEnd
= cmRemoveDuplicates(sources); = cmRemoveDuplicates(sources);

View File

@ -521,7 +521,8 @@ bool cmGlobalGhsMultiGenerator::IsTgtForBuild(const cmTarget *tgt)
const std::string config = const std::string config =
tgt->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"); tgt->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
std::vector<cmSourceFile *> tgtSources; std::vector<cmSourceFile *> tgtSources;
tgt->GetSourceFiles(tgtSources, config); cmGeneratorTarget* gt = this->GetGeneratorTarget(tgt);
gt->GetSourceFiles(tgtSources, config);
bool tgtInBuild = true; bool tgtInBuild = true;
char const *excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL"); char const *excludeFromAll = tgt->GetProperty("EXCLUDE_FROM_ALL");
if (NULL != excludeFromAll && '1' == excludeFromAll[0] && if (NULL != excludeFromAll && '1' == excludeFromAll[0] &&

View File

@ -139,7 +139,9 @@ bool cmGlobalKdevelopGenerator
ti != targets.end(); ti++) ti != targets.end(); ti++)
{ {
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
ti->second.GetSourceFiles(sources, ti->second.GetMakefile() cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&ti->second);
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

@ -1149,7 +1149,7 @@ cmMakefileTargetGenerator
{ {
// Depend on all custom command outputs. // Depend on all custom command outputs.
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
this->Target->GetSourceFiles(sources, this->GeneratorTarget->GetSourceFiles(sources,
this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for(std::vector<cmSourceFile*>::const_iterator source = sources.begin(); for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
source != sources.end(); ++source) source != sources.end(); ++source)

View File

@ -112,7 +112,7 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules()
// Write rules for languages compiled in this target. // Write rules for languages compiled in this target.
std::set<std::string> languages; std::set<std::string> languages;
std::vector<cmSourceFile*> sourceFiles; std::vector<cmSourceFile*> sourceFiles;
this->GetTarget()->GetSourceFiles(sourceFiles, this->GetGeneratorTarget()->GetSourceFiles(sourceFiles,
this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE")); this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE"));
for(std::vector<cmSourceFile*>::const_iterator for(std::vector<cmSourceFile*>::const_iterator
i = sourceFiles.begin(); i != sourceFiles.end(); ++i) i = sourceFiles.begin(); i != sourceFiles.end(); ++i)

View File

@ -58,7 +58,7 @@ void cmNinjaUtilityTargetGenerator::Generate()
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
std::string config = this->GetMakefile() std::string config = this->GetMakefile()
->GetSafeDefinition("CMAKE_BUILD_TYPE"); ->GetSafeDefinition("CMAKE_BUILD_TYPE");
this->GetTarget()->GetSourceFiles(sources, config); this->GetGeneratorTarget()->GetSourceFiles(sources, config);
for(std::vector<cmSourceFile*>::const_iterator source = sources.begin(); for(std::vector<cmSourceFile*>::const_iterator source = sources.begin();
source != sources.end(); ++source) source != sources.end(); ++source)
{ {