summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-05-05 15:21:37 (GMT)
committerBrad King <brad.king@kitware.com>2022-05-05 15:23:40 (GMT)
commit40f380fcb0f3d0990a5f537100e3eb413b9e0639 (patch)
tree7fdcbc73739ee256fc292c25cbfc8f7de8630174 /Source
parentc6b0657f5b13bfe4cdb26cab1008cb83510e7fb0 (diff)
downloadCMake-40f380fcb0f3d0990a5f537100e3eb413b9e0639.zip
CMake-40f380fcb0f3d0990a5f537100e3eb413b9e0639.tar.gz
CMake-40f380fcb0f3d0990a5f537100e3eb413b9e0639.tar.bz2
cmCoreTryCompile: Replace vector push_back with emplace_back
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCoreTryCompile.cxx24
1 files changed, 12 insertions, 12 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 27a47aa..5bdd888 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -108,7 +108,7 @@ public:
std::string value = makefile->GetSafeDefinition(var);
if (warnCMP0067 && !value.empty()) {
value.clear();
- warnCMP0067Variables.push_back(var);
+ warnCMP0067Variables.emplace_back(var);
}
return value;
};
@@ -335,11 +335,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
} else if (argv[i] == "__CMAKE_INTERNAL") {
doing = DoingCMakeInternal;
} else if (doing == DoingCMakeFlags) {
- cmakeFlags.push_back(argv[i]);
+ cmakeFlags.emplace_back(argv[i]);
} else if (doing == DoingCompileDefinitions) {
cmExpandList(argv[i], compileDefs);
} else if (doing == DoingLinkOptions) {
- linkOptions.push_back(argv[i]);
+ linkOptions.emplace_back(argv[i]);
} else if (doing == DoingLinkLibraries) {
libsToLink += "\"" + cmTrimWhitespace(argv[i]) + "\" ";
if (cmTarget* tgt = this->Makefile->FindTargetToUse(argv[i])) {
@@ -364,7 +364,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
return -1;
}
if (tgt->IsImported()) {
- targets.push_back(argv[i]);
+ targets.emplace_back(argv[i]);
}
}
} else if (doing == DoingOutputVariable) {
@@ -377,7 +377,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
copyFileError = argv[i];
doing = DoingNone;
} else if (doing == DoingSources) {
- sources.push_back(argv[i]);
+ sources.emplace_back(argv[i]);
} else if (doing == DoingCMakeInternal) {
cmakeInternal = argv[i];
doing = DoingNone;
@@ -488,7 +488,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
// Choose sources.
if (!useSources) {
- sources.push_back(argv[2]);
+ sources.emplace_back(argv[2]);
}
// Detect languages to enable.
@@ -944,13 +944,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES)) {
vars.erase(kCMAKE_OSX_ARCHITECTURES);
std::string flag = "-DCMAKE_OSX_ARCHITECTURES=" + *tcArchs;
- cmakeFlags.push_back(std::move(flag));
+ cmakeFlags.emplace_back(std::move(flag));
}
for (std::string const& var : vars) {
if (cmValue val = this->Makefile->GetDefinition(var)) {
std::string flag = "-D" + var + "=" + *val;
- cmakeFlags.push_back(std::move(flag));
+ cmakeFlags.emplace_back(std::move(flag));
}
}
}
@@ -960,7 +960,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
for (std::string const& var : ghs_platform_vars) {
if (cmValue val = this->Makefile->GetDefinition(var)) {
std::string flag = "-D" + var + "=" + "'" + *val + "'";
- cmakeFlags.push_back(std::move(flag));
+ cmakeFlags.emplace_back(std::move(flag));
}
}
}
@@ -1105,18 +1105,18 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName,
// if a config was specified try that first
if (cmNonempty(config)) {
std::string tmp = cmStrCat('/', *config);
- searchDirs.push_back(std::move(tmp));
+ searchDirs.emplace_back(std::move(tmp));
}
searchDirs.emplace_back("/Debug");
#if defined(__APPLE__)
std::string app = "/" + targetName + ".app";
if (cmNonempty(config)) {
std::string tmp = cmStrCat('/', *config, app);
- searchDirs.push_back(std::move(tmp));
+ searchDirs.emplace_back(std::move(tmp));
}
std::string tmp = "/Debug" + app;
searchDirs.emplace_back(std::move(tmp));
- searchDirs.push_back(std::move(app));
+ searchDirs.emplace_back(std::move(app));
#endif
searchDirs.emplace_back("/Development");