Commit 2572b824 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'cmGeneratorTarget-cleanup'

cc6b948e cmGeneratorTarget: factor out common part of AddSources commands
52052ef8 cmGeneratorTarget: use erase-unique instead of reinitialization
3b362230 cmGeneratorTarget: don't clear container in destructor
parents c40cbccf cc6b948e
...@@ -327,7 +327,6 @@ cmGeneratorTarget::~cmGeneratorTarget() ...@@ -327,7 +327,6 @@ cmGeneratorTarget::~cmGeneratorTarget()
cmDeleteAll(this->CompileDefinitionsEntries); cmDeleteAll(this->CompileDefinitionsEntries);
cmDeleteAll(this->SourceEntries); cmDeleteAll(this->SourceEntries);
cmDeleteAll(this->LinkInformation); cmDeleteAll(this->LinkInformation);
this->LinkInformation.clear();
} }
cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const
...@@ -469,9 +468,8 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config, ...@@ -469,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);
...@@ -481,19 +479,17 @@ void cmGeneratorTarget::AddSource(const std::string& src) ...@@ -481,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));
} }
} }
...@@ -840,14 +836,10 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory( ...@@ -840,14 +836,10 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(
&dagChecker, result, excludeImported); &dagChecker, result, excludeImported);
} }
std::set<std::string> unique; std::for_each(result.begin(), result.end(),
for (std::vector<std::string>::iterator li = result.begin(); cmSystemTools::ConvertToUnixSlashes);
li != result.end(); ++li) { std::sort(result.begin(), result.end());
cmSystemTools::ConvertToUnixSlashes(*li); result.erase(std::unique(result.begin(), result.end()), result.end());
unique.insert(*li);
}
result.clear();
result.insert(result.end(), unique.begin(), unique.end());
IncludeCacheType::value_type entry(config_upper, result); IncludeCacheType::value_type entry(config_upper, result);
iter = this->SystemIncludesCache.insert(entry).first; iter = this->SystemIncludesCache.insert(entry).first;
......
...@@ -540,6 +540,8 @@ public: ...@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment