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

string-view-lite: modernize #8777

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions recipes/string-view-lite/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
sources:
"1.3.0":
url: https://github.com/martinmoene/string-view-lite/archive/v1.3.0.tar.gz
sha256: d83adb0495ccfba50ae5a1af70bde04f33a26dc40599b0ce9e55f09c075daf23
"1.4.0":
url: https://github.com/martinmoene/string-view-lite/archive/v1.4.0.tar.gz
sha256: 650c135be0bdc5bcae6876864b8279f15b1b97069da944ec2c773cacdea27e27
"1.5.1":
url: https://github.com/martinmoene/string-view-lite/archive/v1.5.1.tar.gz
sha256: 1212d30b404a2c0a6f7192465102501955dcf3740ee100474e8fc2ac8e783c2f
"1.6.0":
url: https://github.com/martinmoene/string-view-lite/archive/v1.6.0.tar.gz
sha256: 852d6dfec810067258a8cfc478d81fe7c08d473701e1989ec59769f549e50bae
url: "https://github.com/martinmoene/string-view-lite/archive/v1.6.0.tar.gz"
sha256: "852d6dfec810067258a8cfc478d81fe7c08d473701e1989ec59769f549e50bae"
"1.5.1":
url: "https://github.com/martinmoene/string-view-lite/archive/v1.5.1.tar.gz"
sha256: "1212d30b404a2c0a6f7192465102501955dcf3740ee100474e8fc2ac8e783c2f"
"1.4.0":
url: "https://github.com/martinmoene/string-view-lite/archive/v1.4.0.tar.gz"
sha256: "650c135be0bdc5bcae6876864b8279f15b1b97069da944ec2c773cacdea27e27"
"1.3.0":
url: "https://github.com/martinmoene/string-view-lite/archive/v1.3.0.tar.gz"
sha256: "d83adb0495ccfba50ae5a1af70bde04f33a26dc40599b0ce9e55f09c075daf23"
18 changes: 12 additions & 6 deletions recipes/string-view-lite/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import os
from conans import ConanFile, tools
import os

required_conan_version = ">=1.43.0"

required_conan_version = ">=1.28.0"

class StringViewLite(ConanFile):
name = "string-view-lite"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/martinmoene/string-view-lite"
description = "string-view lite - A C++17-like string_view for C++98, C++11 and later in a single-file header-only library"
topics = ("conan", "cpp98", "cpp11", "cpp14", "cpp17", "string-view", "string-view-implementations")
topics = ("cpp98", "cpp11", "cpp14", "cpp17", "string-view", "string-view-implementations")
license = "BSL-1.0"
settings = "os", "arch", "compiler", "build_type"
no_copy_source = True

@property
Expand All @@ -20,18 +22,22 @@ def package_id(self):
self.info.header_only()

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)
tools.get(**self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

def package(self):
self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include"))
self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder)

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "string-view-lite")
self.cpp_info.set_property("cmake_target_name", "nonstd::string-view-lite")

# TODO: to remove in conan v2 once cmake_find_package* generators removed
self.cpp_info.filenames["cmake_find_package"] = "string-view-lite"
self.cpp_info.filenames["cmake_find_package_multi"] = "string-view-lite"
self.cpp_info.names["cmake_find_package"] = "nonstd"
self.cpp_info.names["cmake_find_package_multi"] = "nonstd"
self.cpp_info.components["stringviewlite"].names["cmake_find_package"] = "string-view-lite"
self.cpp_info.components["stringviewlite"].names["cmake_find_package_multi"] = "string-view-lite"
self.cpp_info.components["stringviewlite"].set_property("cmake_target_name", "nonstd::string-view-lite")
2 changes: 1 addition & 1 deletion recipes/string-view-lite/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1)
project(test_package CXX)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
conan_basic_setup(TARGETS)

find_package(string-view-lite REQUIRED CONFIG)

Expand Down
6 changes: 3 additions & 3 deletions recipes/string-view-lite/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
from conans import ConanFile, CMake, tools
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"

def build(self):
Expand All @@ -12,6 +12,6 @@ def build(self):
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
8 changes: 4 additions & 4 deletions recipes/string-view-lite/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
versions:
"1.3.0":
folder: all
"1.4.0":
"1.6.0":
folder: all
"1.5.1":
folder: all
"1.6.0":
"1.4.0":
folder: all
"1.3.0":
folder: all