Move ws2_32 dependency to the correct place
It is rdr and network that needs it, not vncviewer.
diff --git a/common/network/CMakeLists.txt b/common/network/CMakeLists.txt
index ddde574..b624c8e 100644
--- a/common/network/CMakeLists.txt
+++ b/common/network/CMakeLists.txt
@@ -3,6 +3,10 @@
add_library(network STATIC
TcpSocket.cxx)
+if(WIN32)
+ target_link_libraries(network ws2_32)
+endif()
+
if(UNIX)
libtool_create_control_file(network)
endif()
diff --git a/common/rdr/CMakeLists.txt b/common/rdr/CMakeLists.txt
index ee71a9b..cc45f91 100644
--- a/common/rdr/CMakeLists.txt
+++ b/common/rdr/CMakeLists.txt
@@ -17,9 +17,9 @@
set(RDR_LIBRARIES ${ZLIB_LIBRARIES} os)
if(GNUTLS_FOUND)
set(RDR_LIBRARIES ${RDR_LIBRARIES} ${GNUTLS_LIBRARIES})
- if(WIN32)
+endif()
+if(WIN32)
set(RDR_LIBRARIES ${RDR_LIBRARIES} ws2_32)
- endif()
endif()
target_link_libraries(rdr ${RDR_LIBRARIES})
diff --git a/vncviewer/CMakeLists.txt b/vncviewer/CMakeLists.txt
index beca98d..c6e778f 100644
--- a/vncviewer/CMakeLists.txt
+++ b/vncviewer/CMakeLists.txt
@@ -48,13 +48,6 @@
target_link_libraries(vncviewer rfb network rdr os Xregion ${FLTK_LIBRARIES} ${GETTEXT_LIBRARIES})
-# 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 AND WIN32)
- target_link_libraries(vncviewer ws2_32)
-endif()
-
install(TARGETS vncviewer DESTINATION ${BIN_DIR})
if(UNIX)
install(FILES vncviewer.man DESTINATION ${MAN_DIR}/man1 RENAME vncviewer.1)