summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Tkac <atkac@redhat.com>2011-01-19 14:20:34 +0000
committerAdam Tkac <atkac@redhat.com>2011-01-19 14:20:34 +0000
commit125bd259b9eda1270f2fb85b0caded5b8780fe37 (patch)
tree582c530527dd6d6fdf86abdf6d35e812fc4f021f
parent179d2b14ecf33058c1bc733cfef5854744809fcc (diff)
downloadtigervnc-125bd259b9eda1270f2fb85b0caded5b8780fe37.tar.gz
tigervnc-125bd259b9eda1270f2fb85b0caded5b8780fe37.zip
[Development] Add possibility to build Windows programs with GNUTLS via cmake.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4241 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r--CMakeLists.txt8
-rw-r--r--common/rdr/CMakeLists.txt7
-rw-r--r--common/rfb/CMakeLists.txt20
-rw-r--r--config.h.cmake.in5
4 files changed, 37 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c08e8b0..9d5bff7a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/common/rdr/CMakeLists.txt b/common/rdr/CMakeLists.txt
index 2872fd71..8be9679e 100644
--- a/common/rdr/CMakeLists.txt
+++ b/common/rdr/CMakeLists.txt
@@ -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})
diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt
index 050d408c..b76e86a4 100644
--- a/common/rfb/CMakeLists.txt
+++ b/common/rfb/CMakeLists.txt
@@ -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})
diff --git a/config.h.cmake.in b/config.h.cmake.in
index 87aa9d52..eee0f779 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -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