summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-01-21 12:53:14 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-01-21 12:53:23 (GMT)
commit1fba410ecf168ab4af500943608a5fb4fad5dc06 (patch)
tree50caa9f75b21da0976eb657d28014988f986fa0c /Source/cmTarget.cxx
parent9ea2f0eb948548aab2fc865d62a658e0c78e90f9 (diff)
parent1ed4d48dcf71df4e8a352bc476262a79d75e299a (diff)
downloadCMake-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/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 7c3827c..fe48934 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -662,7 +662,7 @@ public:
}
};
-cmSourceFile* cmTarget::AddSource(const std::string& src)
+cmSourceFile* cmTarget::AddSource(const std::string& src, bool before)
{
cmSourceFileLocation sfl(this->Makefile, src,
cmSourceFileLocationKind::Known);
@@ -671,8 +671,14 @@ cmSourceFile* cmTarget::AddSource(const std::string& src)
TargetPropertyEntryFinder(sfl)) ==
this->Internal->SourceEntries.end()) {
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->SourceEntries.push_back(src);
- this->Internal->SourceBacktraces.push_back(lfbt);
+ this->Internal->SourceEntries.insert(
+ before ? this->Internal->SourceEntries.begin()
+ : this->Internal->SourceEntries.end(),
+ src);
+ this->Internal->SourceBacktraces.insert(
+ before ? this->Internal->SourceBacktraces.begin()
+ : this->Internal->SourceBacktraces.end(),
+ lfbt);
}
if (cmGeneratorExpression::Find(src) != std::string::npos) {
return nullptr;