cmake: Fix function detection
authorAndreas Schneider <asn@samba.org>
Wed, 29 Aug 2018 06:28:10 +0000 (08:28 +0200)
committerAndreas Schneider <asn@samba.org>
Wed, 29 Aug 2018 14:20:33 +0000 (16:20 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
ConfigureChecks.cmake

index fec66d065ef9e3d6cef3a4dae679183852c5db06..09909402e3c44a8fe72f27a0d5b7f73d08ceaa40 100644 (file)
@@ -59,6 +59,9 @@ if (RESOLV_LIRBRARY)
     if (RES_SEND_IN_LIBRESOLV OR __RES_SEND_IN_LIBRESOLV)
         set(HAVE_LIBRESOLV TRUE)
     endif()
+
+    # If we have a libresolv, we need to check functions linking the library
+    set(CMAKE_REQUIRED_LIBRARIES ${RESOLV_LIRBRARY})
 endif()
 
 check_function_exists(res_init HAVE_RES_INIT)
@@ -91,6 +94,8 @@ check_function_exists(__res_search HAVE___RES_SEARCH)
 check_function_exists(res_nsearch HAVE_RES_NSEARCH)
 check_function_exists(__res_nsearch HAVE___RES_NSEARCH)
 
+unset(CMAKE_REQUIRED_LIBRARIES)
+
 check_symbol_exists(ns_name_compress "sys/types.h;arpa/nameser.h" HAVE_NS_NAME_COMPRESS)
 
 if (UNIX)