aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJulius Brüggemann <julius9402@gmail.com>2021-03-29 19:57:08 +0200
committerUrs Fleisch <ufleisch@users.sourceforge.net>2021-03-29 20:21:59 +0200
commit1644c0dd87f40a2492bde4011fe72257fc72ee0e (patch)
tree7185753a54d0729972923663c98371c5c88ee985 /CMakeLists.txt
parent85cc41082c85b6880c9fd4f4c4783926b930a188 (diff)
Add CMake option for building with ZLib
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt29
1 files changed, 17 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.
-
-if(NOT ZLIB_SOURCE)
- find_package(ZLIB)
- if(ZLIB_FOUND)
+option(WITH_ZLIB "Build with ZLIB" ON)
+
+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()
+
+ if(NOT HAVE_ZLIB AND ZLIB_SOURCE)
set(HAVE_ZLIB 1)
- set(ZLIB_LIBRARIES_FLAGS -lz)
- else()
- set(HAVE_ZLIB 0)
+ set(HAVE_ZLIB_SOURCE 1)
endif()
-endif()
-
-if(NOT HAVE_ZLIB AND ZLIB_SOURCE)
- set(HAVE_ZLIB 1)
- set(HAVE_ZLIB_SOURCE 1)
+else()
+ set(HAVE_ZLIB 0)
endif()
if(NOT WIN32)