network: fix link issue with older libc

Amend 68b625901f and fix link issue with
slightly less modern libc/libresolv where not all functions have been
moved over to libc.

ld: src/network/CMakeFiles/Network.dir/kernel/qdnslookup_unix.cpp.o: in function `QDnsLookupRunnable::query(QDnsLookupReply*)':
qdnslookup_unix.cpp:(.text+0x183): undefined reference to `__res_nquery'
ld: qdnslookup_unix.cpp:(.text+0x437): undefined reference to `__dn_expand'
ld: qdnslookup_unix.cpp:(.text+0x621): undefined reference to `__dn_expand'
ld: qdnslookup_unix.cpp:(.text+0x8ff): undefined reference to `__res_nquery'
ld: qdnslookup_unix.cpp:(.text+0xbd7): undefined reference to `__dn_expand'
ld: qdnslookup_unix.cpp:(.text+0xd7f): undefined reference to `__dn_expand'
ld: qdnslookup_unix.cpp:(.text+0xf4f): undefined reference to `__dn_expand'
ld: qdnslookup_unix.cpp:(.text+0x10fa): undefined reference to `__dn_expand'
ld: qdnslookup_unix.cpp:(.text+0x131c): undefined reference to `__dn_expand'
collect2: error: ld returned 1 exit status

Change-Id: If81b292222c78d828b9fef61f30a62f1d584c183
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Samuli Piippo 2023-05-19 09:48:59 +03:00 committed by Thiago Macieira
parent 2794742fac
commit 4a46ba1209

View File

@ -29,15 +29,19 @@ check_cxx_source_compiles("
#include <netinet/in.h>
#include <resolv.h>
int main(int, char **)
int main(int, char **argv)
{
res_init();
res_state statep;
int n = res_nmkquery(statep, 0, argv[1], 0, 0, NULL, 0, NULL, NULL, 0);
n = res_nsend(statep, NULL, 0, NULL, 0);
n = dn_expand(NULL, NULL, NULL, NULL, 0);
return n;
}
" HAVE_RES_INIT)
" HAVE_LIBRESOLV_FUNCTIONS)
cmake_pop_check_state()
if(HAVE_RES_INIT)
if(HAVE_LIBRESOLV_FUNCTIONS)
set(WrapResolv_FOUND ON)
add_library(WrapResolv::WrapResolv INTERFACE IMPORTED)
if(LIBRESOLV)