Revert "[cmake] Enable zlib support on windows"

This reverts commit r319533 as it broke llvm-config --system-libs output
and everything that depends on it (which is mostly out of tree or
downstream folks, but includes a couple of llvm buildbots as well).

I think I have a fix for this in D40779, but I want someone to look
review it first. In the mean time, I am reverting this change, as it
seems to break a lot of people.

llvm-svn: 319663
This commit is contained in:
Pavel Labath 2017-12-04 16:46:20 +00:00
parent 5f7f32c382
commit f2fdc183b7
2 changed files with 38 additions and 42 deletions

View File

@ -127,49 +127,45 @@ if(HAVE_LIBPTHREAD)
set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT}) set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
endif() endif()
# Don't look for these libraries if we're using MSan, since uninstrumented third # Don't look for these libraries on Windows. Also don't look for them if we're
# party code may call MSan interceptors like strlen, leading to false positives. # using MSan, since uninstrumented third party code may call MSan interceptors
if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") # like strlen, leading to false positives.
find_library(ZLIB_LIBRARY_PATH NAMES z zlib) if( NOT PURE_WINDOWS AND NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
if (LLVM_ENABLE_ZLIB AND ZLIB_LIBRARY_PATH) if (LLVM_ENABLE_ZLIB)
check_library_exists(${ZLIB_LIBRARY_PATH} compress2 "" HAVE_LIBZ) check_library_exists(z compress2 "" HAVE_LIBZ)
else() else()
set(HAVE_LIBZ 0) set(HAVE_LIBZ 0)
endif() endif()
# Skip libedit if using ASan as it contains memory leaks.
# Don't look for these libraries on Windows. if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
if (NOT PURE_WINDOWS) check_library_exists(edit el_init "" HAVE_LIBEDIT)
# Skip libedit if using ASan as it contains memory leaks. else()
if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*") set(HAVE_LIBEDIT 0)
check_library_exists(edit el_init "" HAVE_LIBEDIT) endif()
else() if(LLVM_ENABLE_TERMINFO)
set(HAVE_LIBEDIT 0) set(HAVE_TERMINFO 0)
endif() foreach(library tinfo terminfo curses ncurses ncursesw)
if(LLVM_ENABLE_TERMINFO) string(TOUPPER ${library} library_suffix)
set(HAVE_TERMINFO 0) check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix})
foreach(library tinfo terminfo curses ncurses ncursesw) if(HAVE_TERMINFO_${library_suffix})
string(TOUPPER ${library} library_suffix) set(HAVE_TERMINFO 1)
check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix}) set(TERMINFO_LIBS "${library}")
if(HAVE_TERMINFO_${library_suffix}) break()
set(HAVE_TERMINFO 1)
set(TERMINFO_LIBS "${library}")
break()
endif()
endforeach()
else()
set(HAVE_TERMINFO 0)
endif()
find_library(ICONV_LIBRARY_PATH NAMES iconv libiconv libiconv-2 c)
set(LLVM_LIBXML2_ENABLED 0)
set(LIBXML2_FOUND 0)
if((LLVM_ENABLE_LIBXML2) AND ((CMAKE_SYSTEM_NAME MATCHES "Linux") AND (ICONV_LIBRARY_PATH) OR APPLE))
find_package(LibXml2)
if (LIBXML2_FOUND)
set(LLVM_LIBXML2_ENABLED 1)
include_directories(${LIBXML2_INCLUDE_DIR})
set(LIBXML2_LIBS "xml2")
endif() endif()
endforeach()
else()
set(HAVE_TERMINFO 0)
endif()
find_library(ICONV_LIBRARY_PATH NAMES iconv libiconv libiconv-2 c)
set(LLVM_LIBXML2_ENABLED 0)
set(LIBXML2_FOUND 0)
if((LLVM_ENABLE_LIBXML2) AND ((CMAKE_SYSTEM_NAME MATCHES "Linux") AND (ICONV_LIBRARY_PATH) OR APPLE))
find_package(LibXml2)
if (LIBXML2_FOUND)
set(LLVM_LIBXML2_ENABLED 1)
include_directories(${LIBXML2_INCLUDE_DIR})
set(LIBXML2_LIBS "xml2")
endif() endif()
endif() endif()
endif() endif()

View File

@ -1,7 +1,4 @@
set(system_libs) set(system_libs)
if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
set(system_libs ${system_libs} ${ZLIB_LIBRARY_PATH})
endif()
if( MSVC OR MINGW ) if( MSVC OR MINGW )
# libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc. # libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc.
set(system_libs ${system_libs} psapi shell32 ole32 uuid) set(system_libs ${system_libs} psapi shell32 ole32 uuid)
@ -24,6 +21,9 @@ elseif( CMAKE_HOST_UNIX )
set(system_libs ${system_libs} atomic) set(system_libs ${system_libs} atomic)
endif() endif()
set(system_libs ${system_libs} ${LLVM_PTHREAD_LIB}) set(system_libs ${system_libs} ${LLVM_PTHREAD_LIB})
if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
set(system_libs ${system_libs} z)
endif()
if( UNIX AND NOT (BEOS OR HAIKU) ) if( UNIX AND NOT (BEOS OR HAIKU) )
set(system_libs ${system_libs} m) set(system_libs ${system_libs} m)
endif() endif()