summaryrefslogtreecommitdiffstats
path: root/llvm/cmake/config-ix.cmake
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2020-01-01 15:01:04 -0800
committerSaleem Abdulrasool <compnerd@compnerd.org>2020-01-01 16:36:59 -0800
commit68a235d07f9e7049c7eb0c8091f37e385327ac28 (patch)
treed532974d63227ba809d1bbe1472a7001a422cb3a /llvm/cmake/config-ix.cmake
parenteeef50b1fee91dbe993187324003d2665ceae331 (diff)
downloadbcm5719-llvm-68a235d07f9e7049c7eb0c8091f37e385327ac28.tar.gz
bcm5719-llvm-68a235d07f9e7049c7eb0c8091f37e385327ac28.zip
build: reduce CMake handling for zlib
Rather than handling zlib handling manually, use `find_package` from CMake to find zlib properly. Use this to normalize the `LLVM_ENABLE_ZLIB`, `HAVE_ZLIB`, `HAVE_ZLIB_H`. Furthermore, require zlib if `LLVM_ENABLE_ZLIB` is set to `YES`, which requires the distributor to explicitly select whether zlib is enabled or not. This simplifies the CMake handling and usage in the rest of the tooling.
Diffstat (limited to 'llvm/cmake/config-ix.cmake')
-rw-r--r--llvm/cmake/config-ix.cmake19
1 files changed, 3 insertions, 16 deletions
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index e7e5e5dcf2f..d5a15a680a6 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -56,7 +56,6 @@ check_include_file(sys/types.h HAVE_SYS_TYPES_H)
check_include_file(termios.h HAVE_TERMIOS_H)
check_include_file(unistd.h HAVE_UNISTD_H)
check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H)
-check_include_file(zlib.h HAVE_ZLIB_H)
check_include_file(fenv.h HAVE_FENV_H)
check_symbol_exists(FE_ALL_EXCEPT "fenv.h" HAVE_DECL_FE_ALL_EXCEPT)
check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
@@ -118,17 +117,8 @@ endif()
# 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} compress2 "" HAVE_LIBZ_${library_suffix})
- if(HAVE_LIBZ_${library_suffix})
- set(HAVE_LIBZ 1)
- set(ZLIB_LIBRARIES "${library}")
- break()
- endif()
- endforeach()
+ find_package(ZLIB REQUIRED)
endif()
# Don't look for these libraries on Windows.
@@ -515,11 +505,8 @@ else( LLVM_ENABLE_THREADS )
message(STATUS "Threads disabled.")
endif()
-if (LLVM_ENABLE_ZLIB )
- # Check if zlib is available in the system.
- if ( NOT HAVE_ZLIB_H OR NOT HAVE_LIBZ )
- set(LLVM_ENABLE_ZLIB 0)
- endif()
+if(LLVM_ENABLE_ZLIB)
+ find_package(ZLIB REQUIRED)
endif()
if (LLVM_ENABLE_DOXYGEN)
OpenPOWER on IntegriCloud