From ed1ef85063fb399c8afd97afc1da4962cd957158 Mon Sep 17 00:00:00 2001 From: DRC Date: Thu, 10 Feb 2011 10:43:05 +0000 Subject: [PATCH] Fix MinGW build breakage git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4282 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- CMakeLists.txt | 2 ++ common/rdr/CMakeLists.txt | 2 +- config.h.cmake.in | 4 ++-- win/CMakeLists.txt | 2 -- win/vncviewer/CMakeLists.txt | 12 ++++++++++-- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d5bff7a..1447ebaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,8 @@ configure_file(config.h.cmake.in config.h) add_definitions(-DHAVE_CONFIG_H) include_directories(${CMAKE_BINARY_DIR}) +add_definitions(-D_WIN32_IE=0x0500 -D_WIN32_WINNT=0x0500) + add_subdirectory(common) add_subdirectory(win) diff --git a/common/rdr/CMakeLists.txt b/common/rdr/CMakeLists.txt index 8be9679e..98a88d29 100644 --- a/common/rdr/CMakeLists.txt +++ b/common/rdr/CMakeLists.txt @@ -16,7 +16,7 @@ add_library(rdr STATIC set(RDR_LIBRARIES zlib os) if(GNUTLS_FOUND) - set(RDR_LIBRARIES ${RDR_LIBRARIES} ${GNUTLS_LIBRARIES}) + set(RDR_LIBRARIES ${RDR_LIBRARIES} ${GNUTLS_LIBRARIES} ws2_32) endif() target_link_libraries(rdr ${RDR_LIBRARIES}) diff --git a/config.h.cmake.in b/config.h.cmake.in index eee0f779..6b1ca3d3 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -6,6 +6,6 @@ #cmakedefine HAVE_VSNPRINTF /* MS Visual Studio 2008 and newer doesn't know ssize_t */ -#if defined(HAVE_GNUTLS) && defined(WIN32) -#define ssize_t long +#if defined(HAVE_GNUTLS) && defined(WIN32) && !defined(__MINGW32__) +typedef size_t ssize_t; #endif diff --git a/win/CMakeLists.txt b/win/CMakeLists.txt index c034f6f6..103520aa 100644 --- a/win/CMakeLists.txt +++ b/win/CMakeLists.txt @@ -1,5 +1,3 @@ -add_definitions(-D_WIN32_IE=0x0500 -D_WIN32_WINNT=0x0500) - include_directories(${CMAKE_SOURCE_DIR}/common ${CMAKE_SOURCE_DIR}/win) configure_file(resdefs.h.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/resdefs.h) diff --git a/win/vncviewer/CMakeLists.txt b/win/vncviewer/CMakeLists.txt index 863e2d07..7870a01e 100644 --- a/win/vncviewer/CMakeLists.txt +++ b/win/vncviewer/CMakeLists.txt @@ -20,8 +20,16 @@ add_executable(vncviewer WIN32 vncviewer.cxx vncviewer.rc) -target_link_libraries(vncviewer rfb rfb_win32 Xregion network rdr - ws2_32.lib) +set(VNCVIEWER_LIBRARIES rfb rfb_win32 Xregion network rdr) + +# When building with GnuTLS, librdr depends on ws2_32, so in order to make +# MinGW happy, we need to put ws2_32 in librdr's target_link_libraries string, +# not here. +if(NOT GNUTLS_FOUND) + set(VNCVIEWER_LIBRARIES ${VNCVIEWER_LIBRARIES} ws2_32) +endif() + +target_link_libraries(vncviewer ${VNCVIEWER_LIBRARIES}) install(TARGETS vncviewer RUNTIME DESTINATION . -- 2.39.5