HomePhabricator

[CMake] Fix ncurses/zlib in LLVM_SYSTEM_LIBS for Windows GNU

Authored by phosek on Aug 24 2020, 11:00 PM.

Description

[CMake] Fix ncurses/zlib in LLVM_SYSTEM_LIBS for Windows GNU

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.

Patch By: haampie

Differential Revision: https://reviews.llvm.org/D86434