sewenew / redis-plus-plus

Redis client written in C++
Apache License 2.0
1.6k stars 347 forks source link

Support keeping alive with interval #470

Closed sewenew closed 1 year ago

david-drinn commented 11 months ago

CHECK_SYMBOL_EXISTS here doesn't play well if including hiredis using CMake 3.24+ FetchContent's new OVERRIDE_FIND_PACKAGE feature, to allow subsequent find_package() calls -- such as the one(s) done here in redis-plus-plus to find the hiredis package -- to route through FetchContent rather than using the system install.

-- Looking for redisEnableKeepAliveWithInterval
CMake Error at /home/user/git/myrepo/build/CMakeFiles/CMakeScratch/TryCompile-gio3ep/CMakeLists.txt:19 (target_link_libraries):
  Target "cmTC_2e968" links to:

    hiredis::hiredis

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

CMake Error at /usr/share/cmake-3.27/Modules/CheckSymbolExists.cmake:140 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  /usr/share/cmake-3.27/Modules/CheckSymbolExists.cmake:66 (__CHECK_SYMBOL_EXISTS_IMPL)
  build/_deps/redis++-src/CMakeLists.txt:169 (CHECK_SYMBOL_EXISTS)
david-drinn commented 11 months ago

Could this be done with a hiredis version check instead of probing like this?

https://stackoverflow.com/a/34140313/2125392

It appears to me that hiredis >= 1.2.0 has this feature.

sewenew commented 11 months ago

Thanks for the suggestion! I'll try to take a look into it.

Regards

srikanthg123 commented 6 months ago

@sewenew Is there any resolution to the error mentioned above error of " hiredis::hiredis

but the target was not found." I'm running into similar issue.

sewenew commented 6 months ago

@sewenew Is there any resolution to the error mentioned above error of " hiredis::hiredis

but the target was not found." I'm running into similar issue.

This means that cmake does not find the hiredis lib. Have you installed hiredis? If you installed it, you can use the -DCMAKE_PREFIX_PATH=/path/to/hiredis/installation/path to specify it.

Regards