summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx46
1 files changed, 26 insertions, 20 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index a94cf6a..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;
@@ -731,7 +737,7 @@ bool cmTarget::PushTLLCommandTrace(TLLSignature signature,
}
}
if (this->TLLCommands.empty() || this->TLLCommands.back().second != lfc) {
- this->TLLCommands.push_back(std::make_pair(signature, lfc));
+ this->TLLCommands.emplace_back(signature, lfc);
}
return ret;
}
@@ -975,7 +981,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->Internal->IncludeDirectoriesEntries.clear();
this->Internal->IncludeDirectoriesBacktraces.clear();
if (value) {
- this->Internal->IncludeDirectoriesEntries.push_back(value);
+ this->Internal->IncludeDirectoriesEntries.emplace_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
}
@@ -983,7 +989,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->Internal->CompileOptionsEntries.clear();
this->Internal->CompileOptionsBacktraces.clear();
if (value) {
- this->Internal->CompileOptionsEntries.push_back(value);
+ this->Internal->CompileOptionsEntries.emplace_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->CompileOptionsBacktraces.push_back(lfbt);
}
@@ -991,7 +997,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->Internal->CompileFeaturesEntries.clear();
this->Internal->CompileFeaturesBacktraces.clear();
if (value) {
- this->Internal->CompileFeaturesEntries.push_back(value);
+ this->Internal->CompileFeaturesEntries.emplace_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->CompileFeaturesBacktraces.push_back(lfbt);
}
@@ -999,7 +1005,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->Internal->CompileDefinitionsEntries.clear();
this->Internal->CompileDefinitionsBacktraces.clear();
if (value) {
- this->Internal->CompileDefinitionsEntries.push_back(value);
+ this->Internal->CompileDefinitionsEntries.emplace_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
}
@@ -1007,7 +1013,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->Internal->LinkOptionsEntries.clear();
this->Internal->LinkOptionsBacktraces.clear();
if (value) {
- this->Internal->LinkOptionsEntries.push_back(value);
+ this->Internal->LinkOptionsEntries.emplace_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->LinkOptionsBacktraces.push_back(lfbt);
}
@@ -1015,7 +1021,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->Internal->LinkDirectoriesEntries.clear();
this->Internal->LinkDirectoriesBacktraces.clear();
if (value) {
- this->Internal->LinkDirectoriesEntries.push_back(value);
+ this->Internal->LinkDirectoriesEntries.emplace_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->LinkDirectoriesBacktraces.push_back(lfbt);
}
@@ -1024,7 +1030,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->Internal->LinkImplementationPropertyBacktraces.clear();
if (value) {
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->LinkImplementationPropertyEntries.push_back(value);
+ this->Internal->LinkImplementationPropertyEntries.emplace_back(value);
this->Internal->LinkImplementationPropertyBacktraces.push_back(lfbt);
}
} else if (prop == propSOURCES) {
@@ -1032,7 +1038,7 @@ void cmTarget::SetProperty(const std::string& prop, const char* value)
this->Internal->SourceBacktraces.clear();
if (value) {
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->SourceEntries.push_back(value);
+ this->Internal->SourceEntries.emplace_back(value);
this->Internal->SourceBacktraces.push_back(lfbt);
}
} else if (prop == propIMPORTED_GLOBAL) {
@@ -1102,49 +1108,49 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value,
}
if (prop == "INCLUDE_DIRECTORIES") {
if (value && *value) {
- this->Internal->IncludeDirectoriesEntries.push_back(value);
+ this->Internal->IncludeDirectoriesEntries.emplace_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->IncludeDirectoriesBacktraces.push_back(lfbt);
}
} else if (prop == "COMPILE_OPTIONS") {
if (value && *value) {
- this->Internal->CompileOptionsEntries.push_back(value);
+ this->Internal->CompileOptionsEntries.emplace_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->CompileOptionsBacktraces.push_back(lfbt);
}
} else if (prop == "COMPILE_FEATURES") {
if (value && *value) {
- this->Internal->CompileFeaturesEntries.push_back(value);
+ this->Internal->CompileFeaturesEntries.emplace_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->CompileFeaturesBacktraces.push_back(lfbt);
}
} else if (prop == "COMPILE_DEFINITIONS") {
if (value && *value) {
- this->Internal->CompileDefinitionsEntries.push_back(value);
+ this->Internal->CompileDefinitionsEntries.emplace_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->CompileDefinitionsBacktraces.push_back(lfbt);
}
} else if (prop == "LINK_OPTIONS") {
if (value && *value) {
- this->Internal->LinkOptionsEntries.push_back(value);
+ this->Internal->LinkOptionsEntries.emplace_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->LinkOptionsBacktraces.push_back(lfbt);
}
} else if (prop == "LINK_DIRECTORIES") {
if (value && *value) {
- this->Internal->LinkDirectoriesEntries.push_back(value);
+ this->Internal->LinkDirectoriesEntries.emplace_back(value);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
this->Internal->LinkDirectoriesBacktraces.push_back(lfbt);
}
} else if (prop == "LINK_LIBRARIES") {
if (value && *value) {
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->LinkImplementationPropertyEntries.push_back(value);
+ this->Internal->LinkImplementationPropertyEntries.emplace_back(value);
this->Internal->LinkImplementationPropertyBacktraces.push_back(lfbt);
}
} else if (prop == "SOURCES") {
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
- this->Internal->SourceEntries.push_back(value);
+ this->Internal->SourceEntries.emplace_back(value);
this->Internal->SourceBacktraces.push_back(lfbt);
} else if (cmHasLiteralPrefix(prop, "IMPORTED_LIBNAME")) {
this->Makefile->IssueMessage(MessageType::FATAL_ERROR,