[PATCH] D86434: Fix ncurses/zlib in LLVM_SYSTEM_LIBS for Windows GNU
Harmen Stoppels via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 01:34:18 PDT 2020
haampie created this revision.
haampie added reviewers: phosek, mati865.
Herald added subscribers: llvm-commits, hiraditya, mgorny.
Herald added a project: LLVM.
haampie requested review of this revision.
For the Windows GNU platform, `CMAKE_FIND_LIBRARY_PREFIXES` is a list containing an empty string, which ended up in a regex capturing group, which is invalid in CMake's regex engine. With this change, we get the following:
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a" ".lib")
get_system_libname(path/to/libz.dll.a zlib)
message("${zlib}")
outputs `z`, as expected.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D86434
Files:
llvm/lib/Support/CMakeLists.txt
Index: llvm/lib/Support/CMakeLists.txt
===================================================================
--- llvm/lib/Support/CMakeLists.txt
+++ llvm/lib/Support/CMakeLists.txt
@@ -4,14 +4,14 @@
function(get_system_libname libpath libname)
get_filename_component(libpath ${libpath} NAME)
- 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(prefixes ${CMAKE_FIND_LIBRARY_PREFIXES})
+ set(suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES})
+ list(FILTER prefixes EXCLUDE REGEX "^\\s*$")
+ list(FILTER suffixes EXCLUDE REGEX "^\\s*$")
+ string(REPLACE ";" "|" prefixes "${prefixes}")
+ string(REPLACE ";" "|" suffixes "${suffixes}")
+ string(REGEX REPLACE "^(${prefixes})" "" libpath ${libpath})
+ string(REGEX REPLACE "(${suffixes})$" "" libpath ${libpath})
set(${libname} "${libpath}" PARENT_SCOPE)
endfunction()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86434.287309.patch
Type: text/x-patch
Size: 1148 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200824/d70a01b7/attachment.bin>
More information about the llvm-commits
mailing list