]> source.dussan.org Git - tigervnc.git/commitdiff
[Development] Add possibility to build Windows programs with GNUTLS via cmake.
authorAdam Tkac <atkac@redhat.com>
Wed, 19 Jan 2011 14:20:34 +0000 (14:20 +0000)
committerAdam Tkac <atkac@redhat.com>
Wed, 19 Jan 2011 14:20:34 +0000 (14:20 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4241 3789f03b-4d11-0410-bbf8-ca57d06f2519

CMakeLists.txt
common/rdr/CMakeLists.txt
common/rfb/CMakeLists.txt
config.h.cmake.in

index 9c08e8b097d84aad9167fd2bb0a72e176ab003b4..9d5bff7aca1b8f5a53408e5a78884cf01d35aa44 100644 (file)
@@ -85,6 +85,14 @@ if(MINGW)
     "<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)
index 2872fd71682f5ae94061bae988eb2400f68e8bf6..8be9679e0ad9341bd80348023efe2e9b81b76562 100644 (file)
@@ -14,4 +14,9 @@ add_library(rdr STATIC
   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})
index 050d408cecb16ddc46ae80543a54b0d892614c82..b76e86a474f1ab3448a6371bacc5c68fbae1bb38 100644 (file)
@@ -1,7 +1,7 @@
 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
@@ -66,4 +66,20 @@ add_library(rfb STATIC
   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})
index 87aa9d52b8a46fe22322b9958d7868110e5e009b..eee0f779ca0765f119f05a7f8cf497f19f2d59ff 100644 (file)
@@ -4,3 +4,8 @@
 #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