[llvm] fc99ddb - [cmake][Windows] Do not strip library prefixes on Windows (#226635)

via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 26 11:10:36 PDT 2026


Author: Alan Zhao
Date: 2026-09-26T11:10:31-07:00
New Revision: fc99ddb168769dd732f40b74c09f9d800c30e7e3

URL: https://github.com/llvm/llvm-project/commit/fc99ddb168769dd732f40b74c09f9d800c30e7e3
DIFF: https://github.com/llvm/llvm-project/commit/fc99ddb168769dd732f40b74c09f9d800c30e7e3.diff

LOG: [cmake][Windows] Do not strip library prefixes on Windows (#226635)

Added: 
    

Modified: 
    llvm/cmake/modules/GetLibraryName.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/GetLibraryName.cmake b/llvm/cmake/modules/GetLibraryName.cmake
index 13c0080671a3c..5aa42c343a3d3 100644
--- a/llvm/cmake/modules/GetLibraryName.cmake
+++ b/llvm/cmake/modules/GetLibraryName.cmake
@@ -5,7 +5,9 @@ function(get_library_name path name)
   set(suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
   list(FILTER prefixes EXCLUDE REGEX "^\\s*$")
   list(FILTER suffixes EXCLUDE REGEX "^\\s*$")
-  if(prefixes)
+  # Do not strip the "lib" prefix for Windows because MSVC-style linkers don't
+  # implicitly add the "lib" prefix.
+  if(prefixes AND NOT Win32)
     string(REPLACE ";" "|" prefixes "${prefixes}")
     string(REGEX REPLACE "^(${prefixes})" "" path ${path})
   endif()


        


More information about the llvm-commits mailing list