@@ -77,16 +77,17 @@ if (WIN32)
77
77
endif ()
78
78
if (OPENSSL_ROOT_DIR AND NUGET)
79
79
message ("Found nuGET installation of OpenSSL!" )
80
+ set (SSL_BITS "x64" )
80
81
# its an openssl downloaded via nuget!
81
82
set (OPENSSL_INCLUDE "${OPENSSL_ROOT_DIR} /build/native/include" )
82
83
set (_OPENSSL_ROOT_HINTS "${OPENSSL_ROOT_DIR} /build/native/include" )
83
84
84
- set (OPENSSL_LIB_DIR "${OPENSSL_ROOT_DIR} /lib/native/v140/windesktop/msvcstl/dyn/rt-dyn/x64/release/ " )
85
+ set (OPENSSL_LIB_DIR "${OPENSSL_ROOT_DIR} /lib/native/v140/windesktop/msvcstl/dyn/rt-dyn/${SSL_BITS} " )
85
86
set (_OPENSSL_ROOT_HINTS "${OPENSSL_ROOT_DIR} /build/native/include" )
86
87
87
88
set (_OPENSSL_ROOT_PATHS
88
89
"${OPENSSL_ROOT_DIR} /build/native/include"
89
- "${OPENSSL_ROOT_DIR} /lib/native/v140/windesktop/msvcstl/dyn/rt-dyn/x64/release /" )
90
+ "${OPENSSL_ROOT_DIR} /lib/native/v140/windesktop/msvcstl/dyn/rt-dyn/${SSL_BITS} /" )
90
91
else ()
91
92
# http://www.slproweb.com/products/Win32OpenSSL.html
92
93
set (_OPENSSL_ROOT_HINTS
@@ -129,7 +130,64 @@ find_path(OPENSSL_INCLUDE_DIR
129
130
)
130
131
131
132
if (WIN32 AND NOT CYGWIN )
132
- if (MSVC )
133
+ if (NUGET)
134
+ # /MD and /MDd are the standard values - if someone wants to use
135
+ # others, the libnames have to change here too
136
+ # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
137
+ # enable OPENSSL_MSVC_STATIC_RT to get the libs build /MT (Multithreaded no-DLL)
138
+ # In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
139
+ # * MD for dynamic-release
140
+ # * MDd for dynamic-debug
141
+ # * MT for static-release
142
+ # * MTd for static-debug
143
+
144
+ # Implementation details:
145
+ # We are using the libraries located in the VC subdir instead of the parent directory eventhough :
146
+ # libeay32MD.lib is identical to ../libeay32.lib, and
147
+ # ssleay32MD.lib is identical to ../ssleay32.lib
148
+ # enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static
149
+
150
+ if (OPENSSL_MSVC_STATIC_RT)
151
+ set (_OPENSSL_MSVC_RT_MODE "MT" )
152
+ else ()
153
+ set (_OPENSSL_MSVC_RT_MODE "MD" )
154
+ endif ()
155
+
156
+ set (LIB_EAY_DEBUG LIB_EAY_DEBUG-NOTFOUND )
157
+ if (EXISTS "${OPENSSL_LIB_DIR} /debug/libeay32.lib" )
158
+ set (LIB_EAY_DEBUG "${OPENSSL_LIB_DIR} /debug/libeay32.lib" )
159
+ endif ()
160
+
161
+ set (LIB_EAY_RELEASE LIB_EAY_RELEASE-NOTFOUND )
162
+ if (EXISTS "${OPENSSL_LIB_DIR} /release/libeay32.lib" )
163
+ set (LIB_EAY_RELEASE "${OPENSSL_LIB_DIR} /release/libeay32.lib" )
164
+ endif ()
165
+
166
+ set (SSL_EAY_DEBUG SSL_EAY_DEBUG-NOTFOUND )
167
+ if (EXISTS "${OPENSSL_LIB_DIR} /debug/ssleay32.lib" )
168
+ set (SSL_EAY_DEBUG "${OPENSSL_LIB_DIR} /debug/ssleay32.lib" )
169
+ endif ()
170
+
171
+ set (SSL_EAY_RELEASE SSL_EAY_RELEASE-NOTFOUND )
172
+ if (EXISTS "${OPENSSL_LIB_DIR} /release/ssleay32.lib" )
173
+ set (SSL_EAY_RELEASE "${OPENSSL_LIB_DIR} /release/ssleay32.lib" )
174
+ endif ()
175
+
176
+ set (LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG} " )
177
+ set (LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE} " )
178
+ set (SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG} " )
179
+ set (SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE} " )
180
+
181
+ include (${CMAKE_CURRENT_LIST_DIR} /SelectLibraryConfigurations.cmake)
182
+ select_library_configurations(LIB_EAY)
183
+ select_library_configurations(SSL_EAY)
184
+
185
+ mark_as_advanced (LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE
186
+ SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE)
187
+ set (OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY} )
188
+ set (OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY} )
189
+ set (OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} )
190
+ elseif (MSVC )
133
191
# /MD and /MDd are the standard values - if someone wants to use
134
192
# others, the libnames have to change here too
135
193
# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
0 commit comments