summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/config-ix.cmake76
-rw-r--r--lib/Support/CMakeLists.txt6
2 files changed, 46 insertions, 36 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index caa538082fc..42597c871ea 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -127,45 +127,55 @@ if(HAVE_LIBPTHREAD)
set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
endif()
-# Don't look for these libraries on Windows. Also don't look for them if we're
-# using MSan, since uninstrumented third party code may call MSan interceptors
-# like strlen, leading to false positives.
-if( NOT PURE_WINDOWS AND NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
- if (LLVM_ENABLE_ZLIB)
- check_library_exists(z compress2 "" HAVE_LIBZ)
- else()
- set(HAVE_LIBZ 0)
- endif()
- # Skip libedit if using ASan as it contains memory leaks.
- if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
- check_library_exists(edit el_init "" HAVE_LIBEDIT)
- else()
- set(HAVE_LIBEDIT 0)
- endif()
- if(LLVM_ENABLE_TERMINFO)
- set(HAVE_TERMINFO 0)
- foreach(library tinfo terminfo curses ncurses ncursesw)
+# Don't look for these libraries if we're using MSan, since uninstrumented third
+# party code may call MSan interceptors like strlen, leading to false positives.
+if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
+ set(HAVE_LIBZ 0)
+ if(LLVM_ENABLE_ZLIB)
+ foreach(library z zlib_static zlib)
string(TOUPPER ${library} library_suffix)
- check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix})
- if(HAVE_TERMINFO_${library_suffix})
- set(HAVE_TERMINFO 1)
- set(TERMINFO_LIBS "${library}")
+ check_library_exists(${library} compress2 "" HAVE_LIBZ_${library_suffix})
+ if(HAVE_LIBZ_${library_suffix})
+ set(HAVE_LIBZ 1)
+ set(ZLIB_LIBRARIES "${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")
+ # Don't look for these libraries on Windows.
+ if (NOT PURE_WINDOWS)
+ # Skip libedit if using ASan as it contains memory leaks.
+ if (LLVM_ENABLE_LIBEDIT AND HAVE_HISTEDIT_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
+ check_library_exists(edit el_init "" HAVE_LIBEDIT)
+ else()
+ set(HAVE_LIBEDIT 0)
+ endif()
+ if(LLVM_ENABLE_TERMINFO)
+ set(HAVE_TERMINFO 0)
+ foreach(library tinfo terminfo curses ncurses ncursesw)
+ string(TOUPPER ${library} library_suffix)
+ check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix})
+ if(HAVE_TERMINFO_${library_suffix})
+ 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()
endif()
endif()
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()