From 1644c0dd87f40a2492bde4011fe72257fc72ee0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20Br=C3=BCggemann?= Date: Mon, 29 Mar 2021 19:57:08 +0200 Subject: [PATCH] Add CMake option for building with ZLib --- CMakeLists.txt | 29 +++++++++++++++++------------ INSTALL.md | 7 +++++++ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe1ef8c0..309f000b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,20 +93,25 @@ math(EXPR TAGLIB_SOVERSION_PATCH "${TAGLIB_SOVERSION_REVISION}") include(ConfigureChecks.cmake) # Determine whether zlib is installed. +option(WITH_ZLIB "Build with ZLIB" ON) -if(NOT ZLIB_SOURCE) - find_package(ZLIB) - if(ZLIB_FOUND) - set(HAVE_ZLIB 1) - set(ZLIB_LIBRARIES_FLAGS -lz) - else() - set(HAVE_ZLIB 0) +if(WITH_ZLIB) + if(NOT ZLIB_SOURCE) + find_package(ZLIB) + if(ZLIB_FOUND) + set(HAVE_ZLIB 1) + set(ZLIB_LIBRARIES_FLAGS -lz) + else() + set(HAVE_ZLIB 0) + endif() endif() -endif() - -if(NOT HAVE_ZLIB AND ZLIB_SOURCE) - set(HAVE_ZLIB 1) - set(HAVE_ZLIB_SOURCE 1) + + if(NOT HAVE_ZLIB AND ZLIB_SOURCE) + set(HAVE_ZLIB 1) + set(HAVE_ZLIB_SOURCE 1) + endif() +else() + set(HAVE_ZLIB 0) endif() if(NOT WIN32) diff --git a/INSTALL.md b/INSTALL.md index 25686d5b..4e7d61e9 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -13,6 +13,12 @@ In order to build the included examples, use the `BUILD_EXAMPLES` option: cmake -DBUILD_EXAMPLES=ON [...] +If you want to build TagLib without ZLib, you can use + + cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DWITH_ZLIB=OFF . + make + sudo make install + See http://www.cmake.org/cmake/help/runningcmake.html for generic help on running CMake. @@ -74,6 +80,7 @@ Useful configuration options used with CMake (GUI and/or command line): | option | description | | ----------------------- | ----------- | + | `WITH_ZLIB=` | Whether to build with ZLib | | `ZLIB_ROOT=` | Where to find ZLib's root directory. Assumes parent of: `\include` and `\lib.`| | `ZLIB_INCLUDE_DIR=` | Where to find ZLib's Include directory.| | `ZLIB_LIBRARY=` | Where to find ZLib's Library.