0

I use cmake for my drogon app as that is default for that. It all worked fine but when I added gRPC, the problem started. As both use c-ares.

First when I added gRPC. This showed up..

CMake Error at CMakeLists.txt:21 (add_executable):
  Target "auth-api" links to target "c-ares::cares" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?

So I added find_package(c-ares) before linking gRPC. Now this comes up...

CMake Error at /usr/local/lib/cmake/Trantor/Findc-ares.cmake:14 (add_library):
  add_library cannot create imported target "c-ares_lib" because another
  target with the same name already exists.
Call Stack (most recent call first):
  CMakeLists.txt:51 (find_package)

I tried adding gRPC at the top. But then it says,

CMake Error at /usr/lib/cmake/c-ares/c-ares-config.cmake:29 (add_library):
  add_library cannot create imported target "c-ares::cares_static" because
  another target with the same name already exists.
Call Stack (most recent call first):
  /usr/local/lib/cmake/grpc/modules/Findc-ares.cmake:18 (find_package)
  /usr/share/cmake-3.22/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /usr/local/lib/cmake/Trantor/TrantorConfig.cmake:41 (find_dependency)
  /usr/share/cmake-3.22/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /usr/local/lib/cmake/Drogon/DrogonConfig.cmake:40 (find_dependency)
  CMakeLists.txt:33 (find_package)

What can I do to fix this?

MohammadArik
  • 71
  • 1
  • 9

0 Answers0