-
Notifications
You must be signed in to change notification settings - Fork 351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add cmake add_subdirectory support #15
base: master
Are you sure you want to change the base?
WIP: Add cmake add_subdirectory support #15
Conversation
Hi @langep Sorry for the late reply. These days I'm busy working on a new open source project. I'm not quite sure if these changes have some side effect, e.g. conflict with pre-installed hiredis. I'll do some research and review your changes latter. Regards |
Hi @langep I tried the In some of my environments, I cannot overwrite the pre-installed hiredis, since some other applications depend on some specific hiredis version. So I cannot merge your change into the master branch by now. Sorry for that. I might try that again in the future, when I can overwrite the pre-installed hiredis.
This is a good idea. I'll modified CMakeLists.txt to add the prefix. Also, I'll pending the Sorry again for can't merge the change, and thanks for your pull request :) Regards |
@sewenew Thank you for reviewing. I tried to make building from a submodule optional. I also made building the tests optional. The defaults reflect your original code i.e. if you don't change the options it will search for an installed When you have time, can you try if it still works for your use cases? |
If you want to build redis-plus-plus from another project (using the hiredis submodule) you can include the following inside the other project's CMakeLists.txt file.
|
This seems great! I'll test on multiple environment ASAP. Also can you remove the changes on the .gitignore file? This seems specific to your building environment. Thank you very much for this pull request! |
Hi @langep I tried your CMakeLists.txt. However, it failed to build the test on Centos 7 GCC 4.8.5, with
It fails to locate libhiredis. I also tried to add the following code in test/CMakeLists.txt, but it still has the same problem:
|
Hi, I patched a current master branch (3ba84a8) with @langep's patches and tried the following on a Debian 'Bullseye' box. Without running option(REDIS_PLUS_PLUS_BUILD_HIREDIS_FROM_SUBMODULE "Build hiredis dependency from submodule instead of system" OFF) The compilation worked perfectly and it linked correctly:
After running option(REDIS_PLUS_PLUS_BUILD_HIREDIS_FROM_SUBMODULE "Build hiredis dependency from submodule instead of system" ON) The compilation worked perfectly and it linked correctly:
I have to stress that I had to do the following, every time I changed the hiredis dependency flag:
Version info:
I'm not a @sewenew, Could you maybe try to check your Regards |
Hi @wingunder I just tried @langep 's patch again with 3 different compilers, and the result is interesting.
The first 2 compilers failed to compile the test code with However, GCC 7.4.0 could compile the test code perfectly, and passed all tests. It seems that some old compilers cannot find the hiredis dependency correctly. Maybe I need to modify the CMakeLists.txt. I'll keep trying in the future. Thanks for your work! Regards |
Hi @sewenew,
Compiled OK with and without the submodule. |
Hi @wingunder Thanks for the info. I'll let you know, when I have progress on this. Regards |
Hi,
I am currently working on a project an want to use redis-plus-plus. I am using cmake and want to setup redis-plus-plus as a submodule in my repository and then include it with
add_subdirectory
in myCMakeLists.txt
.The additions I made:
target_link_libraries
with a useful name.include_directories
..devcontainer/*
: I am working on Windows, these files are used by Visual Studio Code's Remote Containers extension to develop inside a Docker container that sets up a functional development environment.If you are interested in these changes, I can also update the documentation.
You need to clone the repository with the
--recursive
flag to get thehiredis
dependency.If you have the repository already clone you probably need to run
git submodule update --init --recursive