-
Notifications
You must be signed in to change notification settings - Fork 934
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
Export targets for CPR (WIP) #56
Conversation
CURL is included in CMake with ExternalProject_Add (if not used a system installation), this way we are able to export targets from CURL and also from our library CPR
Thanks @jgsogo for the PR! The version number for the next release will be 1.2.0. See issue #43. There's a lot of CMake here I'm not familiar with. Are there resources (besides the documentation) you can point me to, to help me grok it a bit faster? I'm all for expanding the integration options for this library, so I really appreciate the pull request. |
The objective is to be able to use CPR in another project just by writing a CMakeLists.txt with these lines:
It may be needed to set a path-variable called See find_package docs for info about how version string is treated. I have been following this document for several projects of mine to create the packages (maybe not so trendy now as they link to an updated doc). I'm testing it now in Windows (make and make install works ok) but I'm finding an issue with curl, why do they call the library |
TODO:
|
Hey @jgsogo, thanks for explaining the motivation behind the changes you're proposing. Currently, it's possible to use Just to clarify, your changes intend to allow you to use |
These are the files generated by CMake that will be handled and found by Another possibility is to implement a But no, this changes won't pull curl automatically with a call to |
@jgsogo, thanks for the great response! I'll take a closer look at this pull request when I have some spare cycles on the weekend. |
I think the reasoning behind this pull request (perhaps not the exact semantics) is perhaps far more relevant today in 2018 than when the pull request was submitted. Modern cmake enabling use of find_package is really a necessity at this point. include_directories() is actually described as an anti-pattern in Daniel Pfeifer’s C++Now 2017 talk on modern cmake. |
Please use GNUInstallDirs. It is portable, the variables can be overridden and package maintainers are familiar with it. |
set(CPR_MAJOR_VERSION 1) | ||
set(CPR_MINOR_VERSION 2) | ||
set(CPR_PATCH_VERSION 0) | ||
set(CPR_VERSION ${CPR_MAJOR_VERSION}.${CPR_MINOR_VERSION}.${CPR_PATCH_VERSION}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version can be specified in project() without having to use 3 extra variables.
Example:
project(cpr
VERSION 0.1.2
LANGUAGES CXX)
This will also automatically generate the 3 variables cpr_VERSION_MAJOR
, cpr_VERSION_MINOR
and cpr_VERSION_PATCH
.
With #383 I would say all features proposed here have been merged. |
I'm working in this pull-request to provide CPR with the CMake sorcery in order to convert it into a package with version semantic and so on... It is a work in progress I'm developing and trying in Windows (MSVC2015) and Ubuntu, but I wanted to share with you these commits in order to know if it is suitable to be merged or I may redirect my efforts into another direction.
Major changes are:
opt/curl
directory although it can start a download or even a clone-update from a remote repositorycpr-config-*
andcpr-version-*
files and making CPR itself installable viamake install
There are still many issues to address, now I can only think in:
Let's talk about it.