diff options
author | Brad King <brad.king@kitware.com> | 2016-09-09 15:18:10 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-09-09 15:18:10 (GMT) |
commit | 2572b824d4b81de83a1b16dee84d8754e846522c (patch) | |
tree | 9b4af472450328f730553c00fea89a6cd50563f4 /Source | |
parent | c40cbccf7d51c2d12a26c3cfc333199fad482c5b (diff) | |
parent | cc6b948e5ea86996fe65014ce8f97bf92b46e4c0 (diff) | |
download | CMake-2572b824d4b81de83a1b16dee84d8754e846522c.zip CMake-2572b824d4b81de83a1b16dee84d8754e846522c.tar.gz CMake-2572b824d4b81de83a1b16dee84d8754e846522c.tar.bz2 |
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
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 32 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.h | 2 |
2 files changed, 14 insertions, 20 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index ee2907c..7dd8e7f 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -327,7 +327,6 @@ cmGeneratorTarget::~cmGeneratorTarget() cmDeleteAll(this->CompileDefinitionsEntries); cmDeleteAll(this->SourceEntries); cmDeleteAll(this->LinkInformation); - this->LinkInformation.clear(); } cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const @@ -469,9 +468,8 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config, 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(); cmGeneratorExpression ge(lfbt); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src); @@ -481,19 +479,17 @@ void cmGeneratorTarget::AddSource(const std::string& src) 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) { this->Target->AddTracedSources(srcs); if (!srcs.empty()) { - std::string srcFiles = 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)); + this->AddSourceCommon(cmJoin(srcs, ";")); } } @@ -840,14 +836,10 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory( &dagChecker, result, excludeImported); } - std::set<std::string> unique; - for (std::vector<std::string>::iterator li = result.begin(); - li != result.end(); ++li) { - cmSystemTools::ConvertToUnixSlashes(*li); - unique.insert(*li); - } - result.clear(); - result.insert(result.end(), unique.begin(), unique.end()); + std::for_each(result.begin(), result.end(), + cmSystemTools::ConvertToUnixSlashes); + std::sort(result.begin(), result.end()); + result.erase(std::unique(result.begin(), result.end()), result.end()); IncludeCacheType::value_type entry(config_upper, result); iter = this->SystemIncludesCache.insert(entry).first; diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 173f15d..715220e 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -540,6 +540,8 @@ public: std::string GetFortranModuleDirectory() const; private: + void AddSourceCommon(const std::string& src); + std::string CreateFortranModuleDirectory() const; mutable bool FortranModuleDirectoryCreated; mutable std::string FortranModuleDirectory; |