summaryrefslogtreecommitdiff
path: root/Source/cmComputeLinkInformation.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r--Source/cmComputeLinkInformation.cxx53
1 files changed, 26 insertions, 27 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index fb13a585b..8a5a6de6c 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -498,8 +498,8 @@ bool cmComputeLinkInformation::Compute()
cmStateEnums::ArtifactType artifact = implib
? cmStateEnums::ImportLibraryArtifact
: cmStateEnums::RuntimeBinaryArtifact;
- std::string lib = tgt->GetFullPath(this->Config, artifact, true);
- this->OldLinkDirItems.push_back(lib);
+ this->OldLinkDirItems.push_back(
+ tgt->GetFullPath(this->Config, artifact, true));
}
}
@@ -598,13 +598,13 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
std::string exe = tgt->GetFullPath(config, artifact, true);
linkItem += exe;
- this->Items.push_back(Item(linkItem, true, tgt));
- this->Depends.push_back(exe);
+ this->Items.emplace_back(linkItem, true, tgt);
+ this->Depends.push_back(std::move(exe));
} else if (tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Add the interface library as an item so it can be considered as part
// of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore
// this for the actual link line.
- this->Items.push_back(Item(std::string(), false, tgt));
+ this->Items.emplace_back(std::string(), false, tgt);
// Also add the item the interface specifies to be used in its place.
std::string const& libName = tgt->GetImportedLibName(config);
@@ -632,7 +632,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
}
} else {
// This is not a CMake target. Use the name given.
- if (cmSystemTools::FileIsFullPath(item.c_str())) {
+ if (cmSystemTools::FileIsFullPath(item)) {
if (cmSystemTools::FileIsDirectory(item)) {
// This is a directory.
this->AddDirectoryItem(item);
@@ -668,13 +668,13 @@ void cmComputeLinkInformation::AddSharedDepItem(std::string const& item,
} else {
// Skip items that are not full paths. We will not be able to
// reliably specify them.
- if (!cmSystemTools::FileIsFullPath(item.c_str())) {
+ if (!cmSystemTools::FileIsFullPath(item)) {
return;
}
// Get the name of the library from the file name.
std::string file = cmSystemTools::GetFilenameName(item);
- if (!this->ExtractSharedLibraryName.find(file.c_str())) {
+ if (!this->ExtractSharedLibraryName.find(file)) {
// This is not the name of a shared library.
return;
}
@@ -913,11 +913,9 @@ std::string cmComputeLinkInformation::CreateExtensionRegex(
// Finish the list.
libext += ")";
- // Add an optional OpenBSD version component.
- if (this->OpenBSD) {
- libext += "(\\.[0-9]+\\.[0-9]+)?";
- } else if (type == LinkShared) {
- libext += "(\\.[0-9]+)?";
+ // Add an optional OpenBSD-style version or major.minor.version component.
+ if (this->OpenBSD || type == LinkShared) {
+ libext += "(\\.[0-9]+)*";
}
libext += "$";
@@ -952,10 +950,10 @@ void cmComputeLinkInformation::SetCurrentLinkType(LinkType lt)
if (this->LinkTypeEnabled) {
switch (this->CurrentLinkType) {
case LinkStatic:
- this->Items.push_back(Item(this->StaticLinkTypeFlag, false));
+ this->Items.emplace_back(this->StaticLinkTypeFlag, false);
break;
case LinkShared:
- this->Items.push_back(Item(this->SharedLinkTypeFlag, false));
+ this->Items.emplace_back(this->SharedLinkTypeFlag, false);
break;
default:
break;
@@ -991,7 +989,7 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
// If this platform wants a flag before the full path, add it.
if (!this->LibLinkFileFlag.empty()) {
- this->Items.push_back(Item(this->LibLinkFileFlag, false));
+ this->Items.emplace_back(this->LibLinkFileFlag, false);
}
// For compatibility with CMake 2.4 include the item's directory in
@@ -1003,7 +1001,7 @@ void cmComputeLinkInformation::AddTargetItem(std::string const& item,
}
// Now add the full path to the library.
- this->Items.push_back(Item(item, true, target));
+ this->Items.emplace_back(item, true, target);
}
void cmComputeLinkInformation::AddFullItem(std::string const& item)
@@ -1058,11 +1056,11 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
// If this platform wants a flag before the full path, add it.
if (!this->LibLinkFileFlag.empty()) {
- this->Items.push_back(Item(this->LibLinkFileFlag, false));
+ this->Items.emplace_back(this->LibLinkFileFlag, false);
}
// Now add the full path to the library.
- this->Items.push_back(Item(item, true));
+ this->Items.emplace_back(item, true);
}
bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item)
@@ -1149,7 +1147,7 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item,
this->SetCurrentLinkType(this->StartLinkType);
// Use the item verbatim.
- this->Items.push_back(Item(item, false));
+ this->Items.emplace_back(item, false);
return;
}
@@ -1221,7 +1219,7 @@ void cmComputeLinkInformation::AddUserItem(std::string const& item,
std::string out = this->LibLinkFlag;
out += lib;
out += this->LibLinkSuffix;
- this->Items.push_back(Item(out, false));
+ this->Items.emplace_back(out, false);
// Here we could try to find the library the linker will find and
// add a runtime information entry for it. It would probably not be
@@ -1256,10 +1254,10 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
this->AddLibraryRuntimeInfo(full_fw);
// Add the item using the -framework option.
- this->Items.push_back(Item("-framework", false));
+ this->Items.emplace_back("-framework", false);
cmOutputConverter converter(this->Makefile->GetStateSnapshot());
fw = converter.EscapeForShell(fw);
- this->Items.push_back(Item(fw, false));
+ this->Items.emplace_back(fw, false);
}
void cmComputeLinkInformation::AddDirectoryItem(std::string const& item)
@@ -1744,12 +1742,13 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
cmSystemTools::ConvertToUnixSlashes(d);
}
if (emitted.insert(d).second) {
- runtimeDirs.push_back(d);
+ runtimeDirs.push_back(std::move(d));
}
} else if (use_link_rpath) {
// Do not add any path inside the source or build tree.
- const char* topSourceDir = this->CMakeInstance->GetHomeDirectory();
- const char* topBinaryDir =
+ std::string const& topSourceDir =
+ this->CMakeInstance->GetHomeDirectory();
+ std::string const& topBinaryDir =
this->CMakeInstance->GetHomeOutputDirectory();
if (!cmSystemTools::ComparePath(ri, topSourceDir) &&
!cmSystemTools::ComparePath(ri, topBinaryDir) &&
@@ -1766,7 +1765,7 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
cmSystemTools::ConvertToUnixSlashes(d);
}
if (emitted.insert(d).second) {
- runtimeDirs.push_back(d);
+ runtimeDirs.push_back(std::move(d));
}
}
}