Nordix / hiredis-cluster

C client library for Valkey/Redis Cluster. This project is used and sponsored by Ericsson. It is a fork of the now unmaintained hiredis-vip.
BSD 3-Clause "New" or "Revised" License
87 stars 42 forks source link

Target "hiredis::hiredis" because target "hiredis" is not a library #173

Closed abhinavbansal19961996 closed 10 months ago

abhinavbansal19961996 commented 1 year ago

Getting below error:

Detected version: 0.10.0
Expecting to find dependencies in path..
CMake package for 'hiredis' not found, searching for the library..
CMake Error at CMakeLists.txt:137 (add_library):
  add_library cannot create ALIAS target "hiredis::hiredis" because target
  "hiredis" is not a library.

Note that i am cloning hiredis library seperately. When i removed above lines and replaced hiredis::hiredis with hiredis. It succeeded.

bjosv commented 10 months ago

After some investigations I can see your error when using an older CMake version (<3.15). The issue can only be seen when one build+install hiredis using Make directly and then build hiredis-cluster using CMake.

CMake 3.15 added the functionality that we use for this case:

The add_library() command ALIAS option learned to support import libraries of the UNKNOWN type.

I'll see if we can handle it differently in our CMakeLists (or add some new build error printouts about how to proceed).