]> source.dussan.org Git - tigervnc.git/commitdiff
Use the system copy of zlib by default, like we do with autotools.
authorPierre Ossman <ossman@cendio.se>
Thu, 3 Mar 2011 09:44:49 +0000 (09:44 +0000)
committerPierre Ossman <ossman@cendio.se>
Thu, 3 Mar 2011 09:44:49 +0000 (09:44 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4313 3789f03b-4d11-0410-bbf8-ca57d06f2519

CMakeLists.txt
common/CMakeLists.txt
common/rdr/CMakeLists.txt

index 854f712dc6a83ca13dbe1c148353bc21bf4483e9..04c769739227e27e3f8f6177700fe103965e09c8 100644 (file)
@@ -85,6 +85,14 @@ if(MINGW)
     "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> --output-format=coff <SOURCE>")
 endif()
 
+# Check for zlib
+find_package(ZLIB)
+option(USE_INCLUDED_ZLIB "Force use of the bundled zlib")
+if(NOT ZLIB_FOUND)
+  message(STATUS "System zlib not found. Using included zlib")
+  set(USE_INCLUDED_ZLIB 1)
+endif()
+
 # Check for GNUTLS library
 find_package(GnuTLS)
 if(GNUTLS_FOUND)
index 145dfdad0ba17d5926a4c4e716744a6c9a18ee1f..59dff7b7abf76a167a0605c7fb29edb3b18cf672 100644 (file)
@@ -1,5 +1,11 @@
+if(USE_INCLUDED_ZLIB)
+  add_subdirectory(zlib)
+
+  set(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/common/zlib)
+  set(ZLIB_LIBRARIES zlib)
+endif()
+
 add_subdirectory(os)
-add_subdirectory(zlib)
 add_subdirectory(rdr)
 add_subdirectory(network)
 add_subdirectory(Xregion)
index 98a88d292b559a27e84e815e8b0431acca0fb172..78033e2dc14635de2027720023140fdb57fd5fcd 100644 (file)
@@ -1,4 +1,4 @@
-include_directories(${CMAKE_SOURCE_DIR}/common ${CMAKE_SOURCE_DIR}/common/zlib)
+include_directories(${CMAKE_SOURCE_DIR}/common ${ZLIB_INCLUDE_DIRS})
 
 add_library(rdr STATIC
   Exception.cxx
@@ -14,7 +14,7 @@ add_library(rdr STATIC
   ZlibInStream.cxx
   ZlibOutStream.cxx)
 
-set(RDR_LIBRARIES zlib os)
+set(RDR_LIBRARIES ${ZLIB_LIBRARIES} os)
 if(GNUTLS_FOUND)
   set(RDR_LIBRARIES ${RDR_LIBRARIES} ${GNUTLS_LIBRARIES} ws2_32)
 endif()