aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/cares.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/cares.cmake')
-rw-r--r--cmake/cares.cmake5
1 files changed, 4 insertions, 1 deletions
diff --git a/cmake/cares.cmake b/cmake/cares.cmake
index 521cf52e77..53d7582f6f 100644
--- a/cmake/cares.cmake
+++ b/cmake/cares.cmake
@@ -18,11 +18,13 @@ if("${gRPC_CARES_PROVIDER}" STREQUAL "module")
endif()
set(CARES_SHARED OFF CACHE BOOL "disable shared library")
set(CARES_STATIC ON CACHE BOOL "link cares statically")
- set(CARES_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/cares/cares")
add_subdirectory(third_party/cares/cares)
+
if(TARGET c-ares)
set(_gRPC_CARES_LIBRARIES c-ares)
+ set(_gRPC_CARES_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/cares/cares" "${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares")
endif()
+
if(gRPC_INSTALL)
message(WARNING "gRPC_INSTALL will be forced to FALSE because gRPC_CARES_PROVIDER is \"module\"")
set(gRPC_INSTALL FALSE)
@@ -31,6 +33,7 @@ elseif("${gRPC_CARES_PROVIDER}" STREQUAL "package")
find_package(c-ares REQUIRED CONFIG)
if(TARGET c-ares::cares)
set(_gRPC_CARES_LIBRARIES c-ares::cares)
+ set(_gRPC_CARES_INCLUDE_DIR ${c-ares_INCLUDE_DIR})
endif()
set(_gRPC_FIND_CARES "if(NOT c-ares_FOUND)\n find_package(c-ares CONFIG)\nendif()")
endif()