Fix finding c-ares in package mode with CMake

The next release of c-ares will install a CMake package (when built
using CMake), but it will be called "c-ares", not "CARES".
pull/11140/head
Alex Merry 8 years ago
parent 44369698fd
commit 8ced27a364
  1. 8
      CMakeLists.txt
  2. 8
      templates/CMakeLists.txt.template
  3. 1
      tools/cmake/gRPCConfig.cmake.in

@ -150,11 +150,11 @@ if("${gRPC_CARES_PROVIDER}" STREQUAL "module")
message(WARNING "gRPC_CARES_PROVIDER is \"module\" but CARES_ROOT_DIR is wrong")
endif()
elseif("${gRPC_CARES_PROVIDER}" STREQUAL "package")
find_package(CARES)
if(TARGET CARES::CARES)
set(_gRPC_CARES_LIBRARIES CARES::CARES)
find_package(c-ares CONFIG)
if(TARGET c-ares::cares)
set(_gRPC_CARES_LIBRARIES c-ares::cares)
endif()
set(_gRPC_FIND_CARES "if(NOT CARES_FOUND)\n find_package(CARES)\nendif()")
set(_gRPC_FIND_CARES "if(NOT c-ares_FOUND)\n find_package(c-ares CONFIG)\nendif()")
endif()
if("${gRPC_PROTOBUF_PROVIDER}" STREQUAL "module")

@ -195,11 +195,11 @@
message(WARNING "gRPC_CARES_PROVIDER is \"module\" but CARES_ROOT_DIR is wrong")
endif()
elseif("<%text>${gRPC_CARES_PROVIDER}</%text>" STREQUAL "package")
find_package(CARES)
if(TARGET CARES::CARES)
set(_gRPC_CARES_LIBRARIES CARES::CARES)
find_package(c-ares CONFIG)
if(TARGET c-ares::cares)
set(_gRPC_CARES_LIBRARIES c-ares::cares)
endif()
set(_gRPC_FIND_CARES "if(NOT CARES_FOUND)\n find_package(CARES)\nendif()")
set(_gRPC_FIND_CARES "if(NOT c-ares_FOUND)\n find_package(c-ares CONFIG)\nendif()")
endif()
if("<%text>${gRPC_PROTOBUF_PROVIDER}</%text>" STREQUAL "module")

@ -2,6 +2,7 @@
@_gRPC_FIND_ZLIB@
@_gRPC_FIND_PROTOBUF@
@_gRPC_FIND_SSL@
@_gRPC_FIND_CARES@
# Targets
include(${CMAKE_CURRENT_LIST_DIR}/gRPCTargets.cmake)

Loading…
Cancel
Save