[glib-networking/openssl-check-msvc] meson.build: Fix OpenSSL detection on Visual Studio
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/openssl-check-msvc] meson.build: Fix OpenSSL detection on Visual Studio
- Date: Wed, 1 Jul 2020 08:56:11 +0000 (UTC)
commit ae57ad5b3e03383a4085479ddd6dcc928b4b2de9
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Jul 1 16:48:47 2020 +0800
meson.build: Fix OpenSSL detection on Visual Studio
Unfortunately, commit 6ea390c broke how OpenSSL is being looked for on Visual
Studio-style builds, because in Meson's Visual Studio support no 'lib' is
prepended to the library name that is being passed into Meson's
'cc.find_library()', and OpenSSL's build files for Visual Studio do prepend
all the .lib's with 'lib', except for its pre-1.1.x SSL/TLS library
(ssleay32.lib).
This fixes the check by prepending the library names with 'lib' where needed
meson.build | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/meson.build b/meson.build
index 3a0548f..def9a19 100644
--- a/meson.build
+++ b/meson.build
@@ -96,6 +96,15 @@ else
# so we check for it manually here in this case, if we can't find those files
# Based on the CMake check for OpenSSL in CURL's CMakeLists.txt,
# on which headers we should check for
+
+ # OpenSSL's MSVC NMake Makefiles prepends the library filenames with 'lib',
+ # so we must prepend the libraries with 'lib' on MSVC, except for the pre-1.1.x
+ # ssleay32.lib
+ openssl_lib_prefix = ''
+ if cc.get_argument_syntax() == 'msvc'
+ openssl_lib_prefix = 'lib'
+ endif
+
openssl_headers = []
foreach h : ['crypto.h', 'engine.h', 'err.h', 'pem.h',
'rsa.h', 'ssl.h', 'x509.h', 'rand.h', 'tls1.h']
@@ -106,11 +115,11 @@ else
# so we need to look for the correct pair
# Find either libcrypto.lib (1.1.x) or libeay32.lib (1.0.x or earlier) first
- libcrypto_dep = cc.find_library('crypto', required: false)
+ libcrypto_dep = cc.find_library('@0@crypto'.format(openssl_lib_prefix), required: false)
if libcrypto_dep.found()
- libssl = 'ssl'
+ libssl = '@0@ssl'.format(openssl_lib_prefix)
else
- libcrypto_dep = cc.find_library('eay32', required: openssl_option)
+ libcrypto_dep = cc.find_library('@0@eay32'.format(openssl_lib_prefix), required: openssl_option)
libssl = 'ssleay32'
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]