summaryrefslogtreecommitdiffstats
path: root/Source/cmComputeLinkInformation.cxx
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2020-03-20 17:05:24 (GMT)
committerRolf Eike Beer <eike@sf-mail.de>2020-03-23 21:41:43 (GMT)
commit48adc297211181a97fab75ef0260fda5147c1195 (patch)
tree17f278522ccaff4b03bc1eb81cb5177fd42d0f37 /Source/cmComputeLinkInformation.cxx
parentbfb69f9543bfa7f9f3c9488bf7e740f21896cec4 (diff)
downloadCMake-48adc297211181a97fab75ef0260fda5147c1195.zip
CMake-48adc297211181a97fab75ef0260fda5147c1195.tar.gz
CMake-48adc297211181a97fab75ef0260fda5147c1195.tar.bz2
replace "std::string::find(x) == 0" with cmHasPrefix()
Diffstat (limited to 'Source/cmComputeLinkInformation.cxx')
-rw-r--r--Source/cmComputeLinkInformation.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 11570d6..aff9dd9 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1200,7 +1200,8 @@ void cmComputeLinkInformation::AddUserItem(BT<std::string> const& item,
// CMP0003 so put it in OldUserFlagItems, if it is not a -l
// or -Wl,-l (-framework -pthread), then allow it without a
// CMP0003 as -L will not affect those other linker flags
- if (item.Value.find("-l") == 0 || item.Value.find("-Wl,-l") == 0) {
+ if (cmHasLiteralPrefix(item.Value, "-l") ||
+ cmHasLiteralPrefix(item.Value, "-Wl,-l")) {
// This is a linker option provided by the user.
this->OldUserFlagItems.push_back(item.Value);
}
@@ -1796,9 +1797,9 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
// support or if using the link path as an rpath.
if (use_build_rpath) {
std::string d = ri;
- if (!rootPath.empty() && d.find(rootPath) == 0) {
+ if (!rootPath.empty() && cmHasPrefix(d, rootPath)) {
d = d.substr(rootPath.size());
- } else if (stagePath && *stagePath && d.find(stagePath) == 0) {
+ } else if (stagePath && *stagePath && cmHasPrefix(d, stagePath)) {
std::string suffix = d.substr(strlen(stagePath));
d = cmStrCat(installPrefix, '/', suffix);
cmSystemTools::ConvertToUnixSlashes(d);
@@ -1827,9 +1828,9 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
!cmSystemTools::IsSubDirectory(ri, topSourceDir) &&
!cmSystemTools::IsSubDirectory(ri, topBinaryDir)) {
std::string d = ri;
- if (!rootPath.empty() && d.find(rootPath) == 0) {
+ if (!rootPath.empty() && cmHasPrefix(d, rootPath)) {
d = d.substr(rootPath.size());
- } else if (stagePath && *stagePath && d.find(stagePath) == 0) {
+ } else if (stagePath && *stagePath && cmHasPrefix(d, stagePath)) {
std::string suffix = d.substr(strlen(stagePath));
d = cmStrCat(installPrefix, '/', suffix);
cmSystemTools::ConvertToUnixSlashes(d);