Logger: Guard zlib usage by ZLIB_FOUND
authorOlivier Goffart <ogoffart@woboq.com>
Wed, 18 Apr 2018 12:18:10 +0000 (14:18 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:57:51 +0000 (10:57 +0100)
Similar to the use for the checksum.
I know that zlib is required in principle, but i don't have it
in one of my test building environment, and it is easier to just
disable it.

src/libsync/logger.cpp

index d5d2048314c2ec49ec98618e6c1e53d5e551dffb..a9df83a635f0859224d24512f326735b3a4da484 100644 (file)
@@ -23,7 +23,9 @@
 
 #include <iostream>
 
+#ifdef ZLIB_FOUND
 #include <zlib.h>
+#endif
 
 #ifdef Q_OS_WIN
 #include <io.h> // for stdout
@@ -261,6 +263,7 @@ void Logger::disableTemporaryFolderLogDir()
 
 static bool compressLog(const QString &originalName, const QString &targetName)
 {
+#ifdef ZLIB_FOUND
     QFile original(originalName);
     if (!original.open(QIODevice::ReadOnly))
         return false;
@@ -279,6 +282,9 @@ static bool compressLog(const QString &originalName, const QString &targetName)
     }
     gzclose(compressed);
     return true;
+#else
+    return false;
+#endif
 }
 
 void Logger::enterNextLogFile()