"<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)
+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)
-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
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()