Skip to content
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

Adding possibility to install library and find_package it #132

Closed

Conversation

daminetreg
Copy link

Dear @whoshuu,

I'm proposing you this small addition to your cmake files in order to allow seamless installation, find_packageing and package generation of CPR.

This is really useful when building systems depending on the library, for example we build IoT devices based on linux, and as we have multiple apps depending on CPR, we would like to compile it and install it once in our development sysroot and depend on it from our different application.

This also ease creating a package with CPack, that you can then distribute to developer as precompiled development package. Or even integrating your library in the CMake Package Manager

For example, thanks to this I can now install and use cpr this way in my project :

cmake_minimum_required(VERSION 3.0.0)

project(testcpr)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(cpr 1.2.1 REQUIRED)
add_executable(testcpr main.cpp)
target_link_libraries(testcpr cpr::cpr)

Thank your for developing this wrapper, I have 2 colleagues who really appreciate the simplicity of the API.

I would be happy to know what do you think from this patch. 😄

Verified

This commit was signed with the committer’s verified signature.
camshaft Cameron Bytheway
@daminetreg
Copy link
Author

Just noticed PR #56 was bringing a similar feature, I think this implementation is cleaner, but that's up to you. The package generation is based on the template of ruslo : https://github.com/forexample/package-example which is in my experience the cleanest way to make packages in modern cmake.

@daminetreg
Copy link
Author

I'll fix the build error, when building CURL from within the submodules.

Some of your CI job requires however CMake older than 3.0.0. It is something you want so ? Meaning I should fix it, or don't you want to upgrade to CMake 3.0.0. I ask this, because package config generation works really in 3.0.0 and not that good before.

@tastytea
Copy link
Contributor

Please use GNUInstallDirs. It is portable and the variables can be overridden.

@COM8
Copy link
Member

COM8 commented Jun 10, 2020

With #383 I would say all features proposed here have been merged.
I’m closing this.
Feel free to open a new PR if something is missing.

@COM8 COM8 closed this Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants