Index: cmake/modules/FindOpenSSL.cmake
===================================================================
--- cmake/modules/FindOpenSSL.cmake	(revision 704723)
+++ cmake/modules/FindOpenSSL.cmake	(working copy)
@@ -16,8 +16,13 @@
    # others, the libnames have to change here too
    # use also eay and libeay32 in debug as fallback for openssl < 0.9.8b
 
-   FIND_LIBRARY(LIB_EAY_DEBUG NAMES libeay32MDd eay libeay libeay32)
-   FIND_LIBRARY(LIB_EAY_RELEASE NAMES libeay32MD eay libeay libeay32)
+   IF(MSVC)
+      FIND_LIBRARY(LIB_EAY_DEBUG NAMES libeay32MDd eay libeay libeay32)
+      FIND_LIBRARY(LIB_EAY_RELEASE NAMES libeay32MD eay libeay libeay32)
+   ELSE(MSVC)
+      FIND_LIBRARY(LIB_EAY_DEBUG NAMES eay libeay libeay32)
+      FIND_LIBRARY(LIB_EAY_RELEASE NAMES eay libeay libeay32)
+   ENDIF(MSVC)
 
    IF(MSVC_IDE)
       IF(LIB_EAY_DEBUG AND LIB_EAY_RELEASE)
@@ -70,9 +75,11 @@
    ENDIF(MSVC_IDE)
    MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE)
 ELSE(WIN32 AND MSVC)
-
-   FIND_LIBRARY(OPENSSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD )
-
+   IF(WIN32)
+      FIND_LIBRARY(OPENSSL_LIBRARIES NAMES ssl ssleay32 )
+   ELSE(WIN32)
+      FIND_LIBRARY(OPENSSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD )
+   ENDIF(WIN32)
 ENDIF(WIN32 AND MSVC)
 
 IF(WIN32)
