diff options
author | Brad King <brad.king@kitware.com> | 2019-01-21 12:53:14 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-01-21 12:53:23 (GMT) |
commit | 1fba410ecf168ab4af500943608a5fb4fad5dc06 (patch) | |
tree | 50caa9f75b21da0976eb657d28014988f986fa0c /Source/cmGeneratorTarget.cxx | |
parent | 9ea2f0eb948548aab2fc865d62a658e0c78e90f9 (diff) | |
parent | 1ed4d48dcf71df4e8a352bc476262a79d75e299a (diff) | |
download | CMake-1fba410ecf168ab4af500943608a5fb4fad5dc06.zip CMake-1fba410ecf168ab4af500943608a5fb4fad5dc06.tar.gz CMake-1fba410ecf168ab4af500943608a5fb4fad5dc06.tar.bz2 |
Merge topic 'autogen_mocs_compilation_first'
1ed4d48dcf Autogen: Prepend instead of append `mocs_compilation.cpp` to the sources list
a42b700cc2 cmTarget,cmGeneratorTarget: Add optional `before` parameter to AddSource
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Peter Wu <peter@lekensteyn.nl>
Merge-request: !2815
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e06d1f2..eb3d4af 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -355,20 +355,22 @@ void cmGeneratorTarget::ClearSourcesCache() this->Objects.clear(); } -void cmGeneratorTarget::AddSourceCommon(const std::string& src) +void cmGeneratorTarget::AddSourceCommon(const std::string& src, bool before) { cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmGeneratorExpression ge(lfbt); std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); cge->SetEvaluateForBuildsystem(true); - this->SourceEntries.push_back(new TargetPropertyEntry(std::move(cge))); + this->SourceEntries.insert(before ? this->SourceEntries.begin() + : this->SourceEntries.end(), + new TargetPropertyEntry(std::move(cge))); this->ClearSourcesCache(); } -void cmGeneratorTarget::AddSource(const std::string& src) +void cmGeneratorTarget::AddSource(const std::string& src, bool before) { - this->Target->AddSource(src); - this->AddSourceCommon(src); + this->Target->AddSource(src, before); + this->AddSourceCommon(src, before); } void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs) @@ -387,12 +389,10 @@ void cmGeneratorTarget::AddIncludeDirectory(const std::string& src, cmGeneratorExpression ge(lfbt); std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); cge->SetEvaluateForBuildsystem(true); - // Insert before begin/end - std::vector<TargetPropertyEntry*>::iterator pos = before - ? this->IncludeDirectoriesEntries.begin() - : this->IncludeDirectoriesEntries.end(); this->IncludeDirectoriesEntries.insert( - pos, new TargetPropertyEntry(std::move(cge))); + before ? this->IncludeDirectoriesEntries.begin() + : this->IncludeDirectoriesEntries.end(), + new TargetPropertyEntry(std::move(cge))); } std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends( |