summaryrefslogtreecommitdiffhomepage
path: root/file.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2024-05-18 16:31:14 +0200
committerRoland Reichwein <mail@reichwein.it>2024-05-18 16:31:14 +0200
commitf857007dbb6a0a26a6828017da64540eda452fbf (patch)
treea2fc22abb236c6f07a9b9425a87b18f5f2e189f8 /file.cpp
parent8a4dfbbbe76a2aef35427b7915d6e28bab165c43 (diff)
Link different kinds of libs
Diffstat (limited to 'file.cpp')
-rw-r--r--file.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/file.cpp b/file.cpp
index 31695e5..b5cbe36 100644
--- a/file.cpp
+++ b/file.cpp
@@ -94,6 +94,19 @@ std::filesystem::path soname_short(const std::filesystem::path& p)
return result;
}
+// e.g.
+// subdir1/libxyz.so.1.2.3 -> xyz
+// libabc.so -> abc
+// file1.so.1 -> file1
+std::string dynamic_lib_name(const std::filesystem::path& p)
+{
+ std::string result {p.stem().string()};
+ if (result.substr(0, 3) == "lib") {
+ result = result.substr(3);
+ }
+ return result;
+}
+
bool is_static_lib(const std::filesystem::path& p)
{
return p.extension() == ".a";