Skip to content

Commit

Permalink
Merge pull request #16 from alexhenrie/master
Browse files Browse the repository at this point in the history
Migrate recipe to Conan 2.0
  • Loading branch information
offa authored Dec 12, 2023
2 parents bf9343b + 04652a6 commit 11023a5
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from conans import ConanFile, CMake, tools
from conan import ConanFile
from conan.tools.cmake import CMake
from conan.tools.files import collect_libs, copy, replace_in_file
from conan.tools.scm import Git


class RestclientcppConan(ConanFile):
Expand All @@ -12,29 +15,24 @@ class RestclientcppConan(ConanFile):
topics = ("restclient", "libcurl", "rest-client", "http-client", "http")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = "shared=False"
generators = "cmake_find_package"
default_options = {"shared": False}
generators = ["CMakeDeps", "CMakeToolchain"]
exports = ["LICENSE"]
_source_dir = "{}-{}".format(name, version)
scm = {
"type": "git",
"subfolder": _source_dir,
"url": "{}.git".format(homepage),
"revision": version
}
requires = (
"libcurl/7.74.0",
"libcurl/8.4.0",
"jsoncpp/1.9.4"
)


def _configure_cmake(self):
cmake = CMake(self)
cmake.configure(source_folder=self._source_dir, build_folder="build")
cmake.configure()
return cmake

def source(self):
tools.replace_in_file("{}/CMakeLists.txt".format(self._source_dir), "CURL::libcurl", "CURL::CURL")
git = Git(self)
git.clone(url=(self.homepage + ".git"), target=".")
git.checkout(commit=self.version)

def build(self):
cmake = self._configure_cmake()
Expand All @@ -43,7 +41,7 @@ def build(self):
def package(self):
cmake = self._configure_cmake()
cmake.install()
self.copy("LICENSE", dst="licenses")
copy(self, "LICENSE", ".", "licenses")

def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.cpp_info.libs = collect_libs(self)

0 comments on commit 11023a5

Please sign in to comment.