Skip to content

Commit 161e3ad

Browse files
authored
(#9159) tl-expected: modernize
* drop cci version * modernize * restore 20190710
1 parent 18a6f13 commit 161e3ad

File tree

6 files changed

+32
-33
lines changed

6 files changed

+32
-33
lines changed

recipes/tl-expected/all/conandata.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sources:
2-
"1.0.0":
3-
url: https://github.com/TartanLlama/expected/archive/v1.0.0.zip
4-
sha256: c1733556cbd3b532a02b68e2fbc2091b5bc2cccc279e4f6c6bd83877aabd4b02
52
"20190710":
6-
url: https://github.com/TartanLlama/expected/archive/6fe2af5191214cce620899f7f06585c047b9f1fc.zip
7-
sha256: 25b009593fcb27aafd3e836e0e726da351b4be7a20703b9bb709a5efd61c26d0
3+
url: "https://github.com/TartanLlama/expected/archive/6fe2af5191214cce620899f7f06585c047b9f1fc.zip"
4+
sha256: "25b009593fcb27aafd3e836e0e726da351b4be7a20703b9bb709a5efd61c26d0"
5+
"1.0.0":
6+
url: "https://github.com/TartanLlama/expected/archive/refs/tags/v1.0.0.tar.gz"
7+
sha256: "8f5124085a124113e75e3890b4e923e3a4de5b26a973b891b3deb40e19c03cee"

recipes/tl-expected/all/conanfile.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
from conans import ConanFile, CMake, tools
2-
from fnmatch import fnmatch
1+
from conans import ConanFile, tools
32
import os
43

5-
required_conan_version = ">=1.28.0"
4+
required_conan_version = ">=1.43.0"
65

76

87
class TlExpectedConan(ConanFile):
@@ -12,38 +11,39 @@ class TlExpectedConan(ConanFile):
1211
description = "C++11/14/17 std::expected with functional-style extensions"
1312
topics = ("cpp11", "cpp14", "cpp17", "expected")
1413
license = "CC0-1.0"
14+
settings = "os", "arch", "compiler", "build_type"
1515
no_copy_source = True
1616

1717
@property
1818
def _source_subfolder(self):
1919
return "source_subfolder"
2020

21-
@property
22-
def _archive_dir(self):
23-
# the archive expands to a directory named expected-[COMMIT SHA1];
24-
# we'd like to put this under a stable name
25-
expected_dirs = [
26-
de for de in os.scandir(self.source_folder)
27-
if de.is_dir() and fnmatch(de.name, "expected-*")
28-
]
29-
return expected_dirs[0].name
21+
def validate(self):
22+
if self.settings.compiler.get_safe("cppstd"):
23+
tools.check_min_cppstd(self, 11)
24+
25+
def package_id(self):
26+
self.info.header_only()
3027

3128
def source(self):
32-
tools.get(**self.conan_data["sources"][self.version])
33-
os.rename(self._archive_dir, self._source_subfolder)
29+
tools.get(**self.conan_data["sources"][self.version],
30+
destination=self._source_subfolder, strip_root=True)
3431

3532
def package(self):
3633
self.copy("*",
3734
src=os.path.join(self._source_subfolder, "include"),
3835
dst="include")
3936
self.copy("COPYING", src=self._source_subfolder, dst="licenses")
4037

41-
def package_id(self):
42-
self.info.header_only()
43-
4438
def package_info(self):
39+
self.cpp_info.set_property("cmake_file_name", "tl-expected")
40+
self.cpp_info.set_property("cmake_target_name", "tl::expected")
41+
42+
# TODO: to remove in conan v2 once cmake_find_package* generators removed
4543
self.cpp_info.filenames["cmake_find_package"] = "tl-expected"
4644
self.cpp_info.filenames["cmake_find_package_multi"] = "tl-expected"
4745
self.cpp_info.names["cmake_find_package"] = "tl"
4846
self.cpp_info.names["cmake_find_package_multi"] = "tl"
49-
self.cpp_info.components["expected"].name = "expected"
47+
self.cpp_info.components["expected"].names["cmake_find_package"] = "expected"
48+
self.cpp_info.components["expected"].names["cmake_find_package_multi"] = "expected"
49+
self.cpp_info.components["expected"].set_property("cmake_target_name", "tl::expected")
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
cmake_minimum_required(VERSION 3.1)
22
project(test_package)
3-
set(CMAKE_CXX_STANDARD 11)
43

54
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
6-
conan_basic_setup()
5+
conan_basic_setup(TARGETS)
76

8-
find_package(tl-expected REQUIRED)
7+
find_package(tl-expected REQUIRED CONFIG)
98

10-
add_executable(${PROJECT_NAME} example.cpp)
9+
add_executable(${PROJECT_NAME} test_package.cpp)
1110
target_link_libraries(${PROJECT_NAME} tl::expected)
11+
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)

recipes/tl-expected/all/test_package/conanfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44

55
class ExpectedTestConan(ConanFile):
6-
settings = "os", "compiler", "build_type", "arch"
7-
generators = "cmake", "cmake_find_package"
6+
settings = "os", "arch", "compiler", "build_type"
7+
generators = "cmake", "cmake_find_package_multi"
88

99
def build(self):
1010
cmake = CMake(self)
1111
cmake.configure()
1212
cmake.build()
1313

1414
def test(self):
15-
if not tools.cross_building(self.settings):
15+
if not tools.cross_building(self):
1616
bin_path = os.path.join("bin", "test_package")
1717
self.run(bin_path, run_environment=True)

recipes/tl-expected/config.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
---
21
versions:
3-
"1.0.0":
4-
folder: all
52
"20190710":
63
folder: all
4+
"1.0.0":
5+
folder: all

0 commit comments

Comments
 (0)