aboutsummaryrefslogtreecommitdiff
path: root/lib/cmake/llvm/GetLibraryName.cmake
diff options
context:
space:
mode:
authorDanny <danny@kdrag0n.dev>2021-01-09 23:34:32 +0000
committermosimchah <mosimchah@gmail.com>2021-01-22 03:35:20 -0800
commit783d21ff74759076d2fc503685ca47d2c29baea3 (patch)
treed650cc46cbf7ca53f15c77ced2682e97d492c068 /lib/cmake/llvm/GetLibraryName.cmake
parentfdbc6f7102056fb52d26bfb2cbc6ea317890ee34 (diff)
Update to 20210109 buildHEADmaster
LLVM commit: https://github.com/llvm/llvm-project/commit/b02eab9058e58782fca32dd8b1e53c27ed93f866 binutils version: 2.35.1 Builder commit: https://github.com/kdrag0n/proton-clang-build/commit/ba42f701467c9103f23fbb90aca4b23858221ee2
Diffstat (limited to 'lib/cmake/llvm/GetLibraryName.cmake')
-rw-r--r--lib/cmake/llvm/GetLibraryName.cmake17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/cmake/llvm/GetLibraryName.cmake b/lib/cmake/llvm/GetLibraryName.cmake
new file mode 100644
index 0000000..13c0080
--- /dev/null
+++ b/lib/cmake/llvm/GetLibraryName.cmake
@@ -0,0 +1,17 @@
+# Returns library name for a given path.
+function(get_library_name path name)
+ get_filename_component(path ${path} NAME)
+ set(prefixes ${CMAKE_FIND_LIBRARY_PREFIXES})
+ set(suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ list(FILTER prefixes EXCLUDE REGEX "^\\s*$")
+ list(FILTER suffixes EXCLUDE REGEX "^\\s*$")
+ if(prefixes)
+ string(REPLACE ";" "|" prefixes "${prefixes}")
+ string(REGEX REPLACE "^(${prefixes})" "" path ${path})
+ endif()
+ if(suffixes)
+ string(REPLACE ";" "|" suffixes "${suffixes}")
+ string(REGEX REPLACE "(${suffixes})$" "" path ${path})
+ endif()
+ set(${name} "${path}" PARENT_SCOPE)
+endfunction()