Skip to content
This repository has been archived by the owner on Apr 6, 2019. It is now read-only.

Use cpp_redis in a linux CMake project #179

Open
HerbertKoelman opened this issue May 22, 2018 · 1 comment
Open

Use cpp_redis in a linux CMake project #179

HerbertKoelman opened this issue May 22, 2018 · 1 comment

Comments

@HerbertKoelman
Copy link

Hello,

Is there an easy way to use cpp_redis in cmake projects ?

I want to know if there is a way to use this kind of cmake feature:

find_package(cpp_redis REQUIRED)

When I use this macro, cmake complains and returns this:

CMake Error at CMakeLists.txt:20 (find_package):
  By not providing "Findcpp_redis.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "cpp_redis", but CMake did not find one.

  Could not find a package configuration file provided by "cpp_redis" with
  any of the following names:

    cpp_redisConfig.cmake
    cpp_redis-config.cmake

  Add the installation prefix of "cpp_redis" to CMAKE_PREFIX_PATH or set
  "cpp_redis_DIR" to a directory containing one of the above files.  If
  "cpp_redis" provides a separate development package or SDK, be sure it has
  been installed.


-- Configuring incomplete, errors occurred!

Any clue ?

@ghost
Copy link

ghost commented Jun 6, 2018

Hello,
You can use add_subdirectory(path/to/cpp_redis/submodule)
NOTE: apparently cpp_redis's CMakeLists.txt does not set the public include paths for the library, so do it yourself:

# (use the correct paths)
add_subdirectory(3rdparty/cpp_redis)
target_include_directories(cpp_redis PUBLIC 
    "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cpp_redis/includes"
    "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cpp_redis/tacopie/includes"
)

and then link your lib/exe with cpp_redis:

target_link_libraries(my_lib
        cpp_redis
    )

You could also use ExternalProject_Add.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant