cmGeneratorTarget: factor out common part of AddSources commands

This commit is contained in:
Daniel Pfeifer 2016-09-07 21:14:29 +02:00
parent 52052ef88b
commit cc6b948e5e
2 changed files with 10 additions and 11 deletions

View File

@ -468,9 +468,8 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config,
return i->second; return i->second;
} }
void cmGeneratorTarget::AddSource(const std::string& src) void cmGeneratorTarget::AddSourceCommon(const std::string& src)
{ {
this->Target->AddSource(src);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge(lfbt);
CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src);
@ -480,19 +479,17 @@ void cmGeneratorTarget::AddSource(const std::string& src)
this->LinkImplementationLanguageIsContextDependent = true; this->LinkImplementationLanguageIsContextDependent = true;
} }
void cmGeneratorTarget::AddSource(const std::string& src)
{
this->Target->AddSource(src);
this->AddSourceCommon(src);
}
void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs) void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs)
{ {
this->Target->AddTracedSources(srcs); this->Target->AddTracedSources(srcs);
if (!srcs.empty()) { if (!srcs.empty()) {
std::string srcFiles = cmJoin(srcs, ";"); this->AddSourceCommon(cmJoin(srcs, ";"));
this->SourceFilesMap.clear();
this->LinkImplementationLanguageIsContextDependent = true;
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
cge->SetEvaluateForBuildsystem(true);
this->SourceEntries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge));
} }
} }

View File

@ -540,6 +540,8 @@ public:
std::string GetFortranModuleDirectory() const; std::string GetFortranModuleDirectory() const;
private: private:
void AddSourceCommon(const std::string& src);
std::string CreateFortranModuleDirectory() const; std::string CreateFortranModuleDirectory() const;
mutable bool FortranModuleDirectoryCreated; mutable bool FortranModuleDirectoryCreated;
mutable std::string FortranModuleDirectory; mutable std::string FortranModuleDirectory;