diff options
| author | Hans Wennborg <hans@chromium.org> | 2020-03-03 09:45:14 +0100 |
|---|---|---|
| committer | Hans Wennborg <hans@chromium.org> | 2020-03-03 14:31:05 +0100 |
| commit | 5f9211bc46fa1a8d1db3a2bc27c2b115cd617795 (patch) | |
| tree | 24cc9f1548a9fe44c228bb76c9e6f5d09a879e3c /llvm/lib | |
| parent | 001c8aac80e3924c33a4cc644cca58401c72fe6b (diff) | |
| download | bcm5719-llvm-5f9211bc46fa1a8d1db3a2bc27c2b115cd617795.tar.gz bcm5719-llvm-5f9211bc46fa1a8d1db3a2bc27c2b115cd617795.zip | |
Revert abb00753 "build: reduce CMake handling for zlib" (PR44780)
and follow-ups:
a2ca1c2d "build: disable zlib by default on Windows"
2181bf40 "[CMake] Link against ZLIB::ZLIB"
1079c68a "Attempt to fix ZLIB CMake logic on Windows"
This changed the output of llvm-config --system-libs, and more
importantly it broke stand-alone builds. Instead of piling on more fix
attempts, let's revert this to reduce the risk of more breakages.
(cherry picked from commit 916be8fd6a0a0feea4cefcbeb0c22c65848d7a2e)
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Support/CMakeLists.txt | 31 | ||||
| -rw-r--r-- | llvm/lib/Support/CRC.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/Support/Compression.cpp | 4 |
3 files changed, 8 insertions, 29 deletions
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt index 5c656164e77..ddc4d2324a0 100644 --- a/llvm/lib/Support/CMakeLists.txt +++ b/llvm/lib/Support/CMakeLists.txt @@ -1,7 +1,7 @@ -if(LLVM_ENABLE_ZLIB) - set(imported_libs ZLIB::ZLIB) +set(system_libs) +if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ ) + set(system_libs ${system_libs} ${ZLIB_LIBRARIES}) endif() - if( MSVC OR MINGW ) # libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc. # advapi32 required for CryptAcquireContextW in lib/Support/Windows/Path.inc. @@ -186,31 +186,10 @@ add_llvm_component_library(LLVMSupport ${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support ${Backtrace_INCLUDE_DIRS} - LINK_LIBS ${system_libs} ${imported_libs} ${delayload_flags} ${Z3_LINK_FILES} + LINK_LIBS ${system_libs} ${delayload_flags} ${Z3_LINK_FILES} ) -set(llvm_system_libs ${system_libs}) - -if(LLVM_ENABLE_ZLIB) - string(TOUPPER ${CMAKE_BUILD_TYPE} build_type) - get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type}) - if(NOT zlib_library) - get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION) - endif() - get_filename_component(zlib_library ${zlib_library} NAME) - if(CMAKE_STATIC_LIBRARY_PREFIX AND - zlib_library MATCHES "^${CMAKE_STATIC_LIBRARY_PREFIX}.*${CMAKE_STATIC_LIBRARY_SUFFIX}$") - STRING(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" zlib_library ${zlib_library}) - STRING(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" zlib_library ${zlib_library}) - elseif(CMAKE_SHARED_LIBRARY_PREFIX AND - zlib_library MATCHES "^${CMAKE_SHARED_LIBRARY_PREFIX}.*${CMAKE_SHARED_LIBRARY_SUFFIX}$") - STRING(REGEX REPLACE "^${CMAKE_SHARED_LIBRARY_PREFIX}" "" zlib_library ${zlib_library}) - STRING(REGEX REPLACE "${CMAKE_SHARED_LIBRARY_SUFFIX}$" "" zlib_library ${zlib_library}) - endif() - set(llvm_system_libs ${llvm_system_libs} "${zlib_library}") -endif() - -set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${llvm_system_libs}") +set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${system_libs}") if(LLVM_WITH_Z3) target_include_directories(LLVMSupport SYSTEM diff --git a/llvm/lib/Support/CRC.cpp b/llvm/lib/Support/CRC.cpp index 2bc668beed3..7ff09debe3b 100644 --- a/llvm/lib/Support/CRC.cpp +++ b/llvm/lib/Support/CRC.cpp @@ -25,7 +25,7 @@ using namespace llvm; -#if !LLVM_ENABLE_ZLIB +#if LLVM_ENABLE_ZLIB == 0 || !HAVE_ZLIB_H static const uint32_t CRCTable[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, diff --git a/llvm/lib/Support/Compression.cpp b/llvm/lib/Support/Compression.cpp index 4165a2740cd..97d5ffaadf8 100644 --- a/llvm/lib/Support/Compression.cpp +++ b/llvm/lib/Support/Compression.cpp @@ -17,13 +17,13 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" #include "llvm/Support/ErrorHandling.h" -#if LLVM_ENABLE_ZLIB +#if LLVM_ENABLE_ZLIB == 1 && HAVE_ZLIB_H #include <zlib.h> #endif using namespace llvm; -#if LLVM_ENABLE_ZLIB +#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ static Error createError(StringRef Err) { return make_error<StringError>(Err, inconvertibleErrorCode()); } |

