"<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> --output-format=coff <SOURCE>")
endif()
+# Check for GNUTLS library
+find_package(GnuTLS)
+if(GNUTLS_FOUND)
+ include_directories(${GNUTLS_INCLUDE_DIR})
+ add_definitions("-DHAVE_GNUTLS")
+ add_definitions(${GNUTLS_DEFINITIONS})
+endif()
+
# Generate config.h
include(CheckIncludeFiles)
include(CheckFunctionExists)
ZlibInStream.cxx
ZlibOutStream.cxx)
-target_link_libraries(rdr zlib os)
+set(RDR_LIBRARIES zlib os)
+if(GNUTLS_FOUND)
+ set(RDR_LIBRARIES ${RDR_LIBRARIES} ${GNUTLS_LIBRARIES})
+endif()
+
+target_link_libraries(rdr ${RDR_LIBRARIES})
include_directories(${CMAKE_SOURCE_DIR}/common ${CMAKE_SOURCE_DIR}/win
${CMAKE_SOURCE_DIR}/common/jpeg ${CMAKE_SOURCE_DIR}/common/jpeg/win)
-add_library(rfb STATIC
+set(RFB_SOURCES
Blacklist.cxx
CConnection.cxx
CMsgHandler.cxx
encodings.cxx
util.cxx)
-target_link_libraries(rfb jpeg os)
+set(RFB_LIBRARIES jpeg os)
+
+if(GNUTLS_FOUND)
+ set(RFB_SOURCES
+ ${RFB_SOURCES}
+ CSecurityTLS.cxx
+ SSecurityTLS.cxx
+ )
+ set(RFB_LIBRARIES
+ ${RFB_LIBRARIES}
+ ${GNUTLS_LIBRARIES}
+ )
+endif()
+
+add_library(rfb STATIC ${RFB_SOURCES})
+
+target_link_libraries(rfb ${RFB_LIBRARIES})
#cmakedefine HAVE_STRCASECMP
#cmakedefine HAVE_STRNCASECMP
#cmakedefine HAVE_VSNPRINTF
+
+/* MS Visual Studio 2008 and newer doesn't know ssize_t */
+#if defined(HAVE_GNUTLS) && defined(WIN32)
+#define ssize_t long
+#endif