[llvm] 1ed1e16 - [CMake] Fix an issue where get_system_libname creates an empty regex capture on windows
Petr Hosek via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 14:34:46 PDT 2020
Author: Petr Hosek
Date: 2020-08-19T14:33:52-07:00
New Revision: 1ed1e16ab83f55d85c90ae43a05cbe08a00c20e0
URL: https://github.com/llvm/llvm-project/commit/1ed1e16ab83f55d85c90ae43a05cbe08a00c20e0
DIFF: https://github.com/llvm/llvm-project/commit/1ed1e16ab83f55d85c90ae43a05cbe08a00c20e0.diff
LOG: [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
Added:
Modified:
llvm/lib/Support/CMakeLists.txt
Removed:
################################################################################
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 42ee6d67361e..e6ff814590d9 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -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()
More information about the llvm-commits
mailing list