This should check if Qt provides zlib functions, and adds zlib dependency in case of zlibless Qt. Tested with Qt providing zlib functions only.
authorunc0rr
Mon, 12 Sep 2011 21:51:14 +0400
changeset 5879 42cf124c305b
parent 5878 404ca990793a
child 5880 a6573cc5903e
This should check if Qt provides zlib functions, and adds zlib dependency in case of zlibless Qt. Tested with Qt providing zlib functions only.
QTfrontend/CMakeLists.txt
--- a/QTfrontend/CMakeLists.txt	Mon Sep 12 18:53:28 2011 +0200
+++ b/QTfrontend/CMakeLists.txt	Mon Sep 12 21:51:14 2011 +0400
@@ -12,6 +12,16 @@
 find_package(Qt4 REQUIRED)
 include(${QT_USE_FILE})
 
+# Check if we need zlib
+check_library_exists(${QT_QTCORE_LIBRARY} inflateInit2_ ${QT_LIBRARY_DIR} QT_PROVIDES_ZLIB_FUNCTIONS)
+
+if(NOT QT_PROVIDES_ZLIB_FUNCTIONS)
+    find_package(ZLIB REQUIRED)
+
+    set(HW_LINK_LIBS ${ZLIB_LIBRARIES} ${HW_LINK_LIBS})
+endif()
+
+
 # Configure for SDL
 find_package(SDL REQUIRED)
 find_package(SDL_mixer REQUIRED)
@@ -216,7 +226,7 @@
 
 if(APPLE)
     set(hwfr_src ${hwfr_src} InstallController.cpp CocoaInitializer.mm M3Panel.mm M3InstallController.m NSWorkspace_RBAdditions.m)
-    set(HW_LINK_LIBS IOKit)
+    set(HW_LINK_LIBS IOKit ${HW_LINK_LIBS})
 
     if(NOT NOAUTOUPDATE)
         find_package(Sparkle)