-
Notifications
You must be signed in to change notification settings - Fork 942
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
CMake find-package support #645
Conversation
Otherwise, we have to export libcurl targets and all deps of libcurl because it is built in-source. CMake is not very user-friendly when it comes to exporting and installing targets of in-source built dependencies.
First thanks for the PR. |
Enforcing
|
That is true, but I was afraid that gtest itself would be installed by default with cpr. But this option is off by default, therefore it should be fine.
Thanks for pointing out, I will have look at it. |
I just tried it locally, and it worked great. Therefore, I will merge your PR. Thanks for the great work! |
I get "Could NOT find CURL (missing: HTTP) (found version "7.80.0")" |
what's the logic behind requiring the system CURL be used in order for CPR to |
This PR improves CMake integration of the library.
I was surprised that one cannot simply download, build, install the library on the system and then simply integrate the library within other project via the standard CMake find-package utility. This PR adds this feature. For instance, now one can import the library in other CMake project like this:
CMakeLists.txt
main.cpp
Note that I handle CURL dependency in cprConfig.cmake.in. This is why one has to only include
find_package(cpr REQUIRED)
.This feature is feasible only if CPR_FORCE_USE_SYSTEM_CURL is set.
Otherwise, you download libcurl in-source and link against its targets.
This is a problem since you have to not only export and install cpr CMake target, but also all targets that cpr target links against.
In this case, curl_int. Further, its dependecies would have to be handled and exported, etc.
In other words, CMake is not a helpful tool for this use case.