1 # Returns library name for a given path.
2 function(get_library_name path name)
3 get_filename_component(path ${path} NAME)
4 set(prefixes ${CMAKE_FIND_LIBRARY_PREFIXES})
5 set(suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
6 list(FILTER prefixes EXCLUDE REGEX "^\\s*$")
7 list(FILTER suffixes EXCLUDE REGEX "^\\s*$")
9 string(REPLACE ";" "|" prefixes "${prefixes}")
10 string(REGEX REPLACE "^(${prefixes})" "" path ${path})
13 string(REPLACE ";" "|" suffixes "${suffixes}")
14 string(REGEX REPLACE "(${suffixes})$" "" path ${path})
16 set(${name} "${path}" PARENT_SCOPE)