From a498b56ba96948015f0f2784b2ab8296946716ee Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 1 Feb 2018 23:28:17 -0800
Subject: [PATCH 4/4] CMakeLists.txt: Find c-ares in target sysroot alone

Current code lets it look into native sysroot as well
which is then preferred during cross compile and it adds
absolute path to libcares into linker flags
on heterogenous architectures linker complains and build
fails

| /mnt/a/oe/build/tmp/work/cortexa7t2hf-neon-vfpv4-bec-linux-gnueabi/grpc/1.8.5-r0/recipe-sysroot-native/usr/lib/lib
cares.so.2.2.0: file not recognized: File format not recognized
| collect2: error: ld returned 1 exit status

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 CMakeLists.txt | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d7eef1..058423d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -153,10 +153,8 @@ if("${gRPC_CARES_PROVIDER}" STREQUAL "module")
     set(gRPC_INSTALL FALSE)
   endif()
 elseif("${gRPC_CARES_PROVIDER}" STREQUAL "package")
-  find_package(c-ares REQUIRED CONFIG)
-  if(TARGET c-ares::cares)
-    set(_gRPC_CARES_LIBRARIES c-ares::cares)
-  endif()
+  find_package(c-ares REQUIRED)
+  set(_gRPC_CARES_LIBRARIES cares)
   set(_gRPC_FIND_CARES "if(NOT c-ares_FOUND)\n  find_package(c-ares CONFIG)\nendif()")
 endif()
 
-- 
2.16.1

