Merge pull request #1660 from trast/tr/fix-zlib-configuration CMakeLists: fix zlib linker setup
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bdc46d0..34d56b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -136,17 +136,15 @@ IF(WIN32 OR AMIGA)
ENDIF()
# Optional external dependency: zlib
-IF(NOT ZLIB_LIBRARY)
- # It's optional, but FIND_PACKAGE gives a warning that looks more like an
- # error.
- FIND_PACKAGE(ZLIB QUIET)
-ENDIF()
+# It's optional, but FIND_PACKAGE gives a warning that looks more like an
+# error.
+FIND_PACKAGE(ZLIB QUIET)
IF (ZLIB_FOUND)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
LINK_LIBRARIES(${ZLIB_LIBRARIES})
# Fake the message CMake would have shown
MESSAGE("-- Found zlib: ${ZLIB_LIBRARY}")
-ELSEIF (NOT ZLIB_LIBRARY)
+ELSE()
MESSAGE( "zlib was not found; using bundled 3rd-party sources." )
INCLUDE_DIRECTORIES(deps/zlib)
ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP)