8000 Finalize Nuget Openssl detection · lethalbrains/arangodb@8e23b46 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8e23b46

Browse files
committed
Finalize Nuget Openssl detection
1 parent 6f69cdf commit 8e23b46

File tree

1 file changed

+61
-3
lines changed

1 file changed

+61
-3
lines changed

cmake/FindOpenSSL.cmake

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,17 @@ if (WIN32)
7777
endif()
7878
if (OPENSSL_ROOT_DIR AND NUGET)
7979
message("Found nuGET installation of OpenSSL!")
80+
set(SSL_BITS "x64")
8081
# its an openssl downloaded via nuget!
8182
set(OPENSSL_INCLUDE "${OPENSSL_ROOT_DIR}/build/native/include")
8283
set(_OPENSSL_ROOT_HINTS "${OPENSSL_ROOT_DIR}/build/native/include")
8384

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}")
8586
set(_OPENSSL_ROOT_HINTS "${OPENSSL_ROOT_DIR}/build/native/include")
8687

8788
set(_OPENSSL_ROOT_PATHS
8889
"${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}/")
9091
else()
9192
# http://www.slproweb.com/products/Win32OpenSSL.html
9293
set(_OPENSSL_ROOT_HINTS
@@ -129,7 +130,64 @@ find_path(OPENSSL_INCLUDE_DIR
129130
)
130131

131132
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)
133191
# /MD and /MDd are the standard values - if someone wants to use
134192
# others, the libnames have to change here too
135193
# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b

0 commit comments

Comments
 (0)
0