[llvm] [llvm-config] Fix system library names for MSVC (PR #222301)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 04:53:10 PDT 2026
================
@@ -1,17 +1,23 @@
# 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})
+ get_filename_component(path "${path}" NAME)
+ if(MSVC)
+ # MSVC library names retain the "lib" prefix. Only remove the extension;
+ # llvm-config adds the .lib suffix.
+ get_filename_component(path "${path}" NAME_WLE)
+ else()
----------------
zhangweize9-cyber wrote:
That's interesting, this approach resolves the boundary cases of the `MSVC` instruction set.
https://github.com/llvm/llvm-project/pull/222301
More information about the llvm-commits
mailing list