summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanc999@yahoo.com.tw>2023-02-09 00:10:27 +0800
committerChun-wei Fan <fanc999@yahoo.com.tw>2023-02-09 00:10:27 +0800
commit53d3147bc9ea955f5ae019bc93677920d8328078 (patch)
tree54b9c1345c4d4a7b3be0a0dfe03de4758dea6d1b
parent809865ddc33a1cb4e9751fd46d915cb1e5014f68 (diff)
downloadgssdp-msvc.tar.gz
build: Fix HAVE_GETIPNETTABLE2 checkmsvc
Look first for iphlpapi.lib (which is required on Windows) and use that as a dependency to link to when checking for the GetIpNetTable2() function, so that the test program properly builds on all compilers that Meson supports on Windows.
-rw-r--r--meson.build9
1 files changed, 6 insertions, 3 deletions
diff --git a/meson.build b/meson.build
index ac24c17..85f1f9a 100644
--- a/meson.build
+++ b/meson.build
@@ -39,8 +39,11 @@ siocgifindex_available = cc.compiles(siocgifindex_test,
name : 'SIOCGIFINDEX is available')
conf.set('HAVE_SIOCGIFINDEX', siocgifindex_available)
-getipnettable2_available = cc.compiles(files('build-aux/getipnettable2-test.c'), args: '-liphlpapi', name: 'GetIpNetTable2 is available')
-conf.set('HAVE_GETIPNETTABLE2', getipnettable2_available)
+iphlpapi_lib = cc.find_library('iphlpapi', required: host_machine.system() == 'windows')
+if iphlpapi_lib.found()
+ getipnettable2_available = cc.compiles(files('build-aux/getipnettable2-test.c'), dependencies: iphlpapi_lib, name: 'GetIpNetTable2 is available')
+ conf.set('HAVE_GETIPNETTABLE2', getipnettable2_available)
+endif
glib_version = '2.70'
conf.set('GLIB_VERSION_MIN_REQUIRED', 'GLIB_VERSION_@0@'.format(glib_version.underscorify()))
@@ -66,7 +69,7 @@ endif
# Check whether we are compiling on/against windows
if host_machine.system() == 'windows'
system_deps += cc.find_library('ws2_32', required: true)
- system_deps += cc.find_library('iphlpapi', required: true)
+ system_deps += iphlpapi_lib
endif
# Assume "other" unix or linux then