summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAlexey Samsonov <samsonov@google.com>2013-04-23 08:28:39 +0000
committerAlexey Samsonov <samsonov@google.com>2013-04-23 08:28:39 +0000
commitee03c949b85036b68c261dcc27dca064ee7e525d (patch)
tree14f060f70c0c6e5346a0f120c196f6718b060cd4 /cmake
parenta8958769ea5583d58ae51931d8b1271c23fd20ea (diff)
downloadllvm-ee03c949b85036b68c261dcc27dca064ee7e525d.tar.gz
llvm-ee03c949b85036b68c261dcc27dca064ee7e525d.tar.bz2
llvm-ee03c949b85036b68c261dcc27dca064ee7e525d.tar.xz
Add basic zlib support to LLVM. This would allow to use compression/uncompression in selected LLVM tools.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180083 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rwxr-xr-xcmake/config-ix.cmake9
-rw-r--r--cmake/modules/LLVM-Config.cmake3
-rw-r--r--cmake/modules/LLVMConfig.cmake.in3
3 files changed, 15 insertions, 0 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 7cad190c11..c426f41f5c 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -79,6 +79,7 @@ check_include_file(unistd.h HAVE_UNISTD_H)
check_include_file(utime.h HAVE_UTIME_H)
check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H)
check_include_file(windows.h HAVE_WINDOWS_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)
@@ -104,6 +105,7 @@ if( NOT PURE_WINDOWS )
endif()
check_library_exists(dl dlopen "" HAVE_LIBDL)
check_library_exists(rt clock_gettime "" HAVE_LIBRT)
+ check_library_exists(z compress2 "" HAVE_LIBZ)
endif()
# function checks
@@ -450,4 +452,11 @@ 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()
+endif()
+
set(LLVM_PREFIX ${CMAKE_INSTALL_PREFIX})
diff --git a/cmake/modules/LLVM-Config.cmake b/cmake/modules/LLVM-Config.cmake
index 163401c857..2ddc0b2bf8 100644
--- a/cmake/modules/LLVM-Config.cmake
+++ b/cmake/modules/LLVM-Config.cmake
@@ -13,6 +13,9 @@ function(get_system_libs return_var)
if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )
set(system_libs ${system_libs} pthread)
endif()
+ if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
+ set(system_libs ${system_libs} z)
+ endif()
endif( MINGW )
endif( NOT MSVC )
set(${return_var} ${system_libs} PARENT_SCOPE)
diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in
index c43119ed3d..f0b8c14ec3 100644
--- a/cmake/modules/LLVMConfig.cmake.in
+++ b/cmake/modules/LLVMConfig.cmake.in
@@ -22,12 +22,15 @@ set(LLVM_TOOLS_BINARY_DIR @LLVM_TOOLS_BINARY_DIR@)
set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS@)
+set(LLVM_ENABLE_ZLIB @LLVM_ENABLE_ZLIB@)
+
set(LLVM_NATIVE_ARCH @LLVM_NATIVE_ARCH@)
set(LLVM_ENABLE_PIC @LLVM_ENABLE_PIC@)
set(HAVE_LIBDL @HAVE_LIBDL@)
set(HAVE_LIBPTHREAD @HAVE_LIBPTHREAD@)
+set(HAVE_LIBZ @HAVE_LIBZ@)
set(LLVM_ON_UNIX @LLVM_ON_UNIX@)
set(LLVM_ON_WIN32 @LLVM_ON_WIN32@)