forked from OSchip/llvm-project
[CMake] Fix an issue where get_system_libname creates an empty regex capture on windows
Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1119478 Patch By: haampie Differential Revision: https://reviews.llvm.org/D86245
This commit is contained in:
parent
7a028fe702
commit
1ed1e16ab8
|
@ -4,10 +4,14 @@ endif()
|
|||
|
||||
function(get_system_libname libpath libname)
|
||||
get_filename_component(libpath ${libpath} NAME)
|
||||
string(REPLACE ";" "|" PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
string(REPLACE ";" "|" SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}")
|
||||
STRING(REGEX REPLACE "^(${PREFIXES})" "" libpath ${libpath})
|
||||
STRING(REGEX REPLACE "(${SUFFIXES})$" "" libpath ${libpath})
|
||||
if( CMAKE_FIND_LIBRARY_PREFIXES )
|
||||
string(REPLACE ";" "|" PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
string(REGEX REPLACE "^(${PREFIXES})" "" libpath ${libpath})
|
||||
endif()
|
||||
if( CMAKE_FIND_LIBRARY_SUFFIXES )
|
||||
string(REPLACE ";" "|" SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}")
|
||||
string(REGEX REPLACE "(${SUFFIXES})$" "" libpath ${libpath})
|
||||
endif()
|
||||
set(${libname} "${libpath}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
|
Loading…
Reference in New Issue