summaryrefslogtreecommitdiff
path: root/lib/Support/CMakeLists.txt
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-12-05 10:24:15 +0000
committerPavel Labath <labath@google.com>2017-12-05 10:24:15 +0000
commitfd8ab369e9aa88dc16583eeff4298c638e017722 (patch)
tree23e1dd6f731c5195fc151694f87ac7f2fb78720b /lib/Support/CMakeLists.txt
parentfa8338cb07e267f6fd9c0b3045d46874dd2ad780 (diff)
Re-commit "[cmake] Enable zlib support on windows"
This recommits r319533 which was broken llvm-config --system-libs output. The reason was that I used find_libraries for searching for the z library. This returns absolute paths, and when these paths made it into llvm-config, it made it produce nonsensical flags. To fix this, I hand-roll a search for the library in the same way that we search for the terminfo library a couple of lines below. This is a bit less flexible than the find_library option, as it does not allow the user to specify the path to the library at configure time (which is important on windows, as zlib is unlikely to be found in any of the standard places cmake searches), but I was able to guide the build to find it with appropriate values of LIB and INCLUDE environment variables. Reviewers: compnerd, rnk, beanz, rafael Subscribers: llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D40779 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319751 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/CMakeLists.txt')
-rw-r--r--lib/Support/CMakeLists.txt6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt
index 5d95a9a9a56..5723f8fcf5b 100644
--- a/lib/Support/CMakeLists.txt
+++ b/lib/Support/CMakeLists.txt
@@ -1,4 +1,7 @@
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.
set(system_libs ${system_libs} psapi shell32 ole32 uuid)
@@ -21,9 +24,6 @@ elseif( CMAKE_HOST_UNIX )
set(system_libs ${system_libs} atomic)
endif()
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) )
set(system_libs ${system_libs} m)
endif()