From 8891f28414e2e1f0fec7bebed4986e0dc3bf9763 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Sun, 30 Jan 2022 21:35:58 +0100 Subject: [PATCH] modernize --- recipes/taocpp-tuple/all/conanfile.py | 21 ++++++++++++------- .../all/test_package/CMakeLists.txt | 2 +- .../all/test_package/conanfile.py | 7 +++---- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/recipes/taocpp-tuple/all/conanfile.py b/recipes/taocpp-tuple/all/conanfile.py index 3a84fee29fcd5..901f53a0bfa76 100644 --- a/recipes/taocpp-tuple/all/conanfile.py +++ b/recipes/taocpp-tuple/all/conanfile.py @@ -1,7 +1,8 @@ -import os from conans import ConanFile, tools +import os + +required_conan_version = ">=1.43.0" -required_conan_version = ">=1.28.0" class TaoCPPTupleConan(ConanFile): name = "taocpp-tuple" @@ -11,32 +12,36 @@ class TaoCPPTupleConan(ConanFile): description = "Compile-time-efficient proof-of-concept implementation for std::tuple" topics = ("template", "cpp11", "tuple") no_copy_source = True - settings = "compiler" + settings = "os", "arch", "compiler", "build_type" @property def _source_subfolder(self): return "source_subfolder" - def configure(self): - if self.settings.compiler.cppstd: + def validate(self): + if self.settings.compiler.get_safe("cppstd"): tools.check_min_cppstd(self, 11) def package_id(self): self.info.header_only() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "tuple-" + 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("LICENSE", dst="licenses", src=self._source_subfolder) self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "taocpp-tuple") + self.cpp_info.set_property("cmake_target_name", "taocpp::tuple") + + # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "taocpp-tuple" self.cpp_info.filenames["cmake_find_package_multi"] = "taocpp-tuple" self.cpp_info.names["cmake_find_package"] = "taocpp" self.cpp_info.names["cmake_find_package_multi"] = "taocpp" self.cpp_info.components["_taocpp-tuple"].names["cmake_find_package"] = "tuple" self.cpp_info.components["_taocpp-tuple"].names["cmake_find_package_multi"] = "tuple" + self.cpp_info.components["_taocpp-tuple"].set_property("cmake_target_name", "taocpp::tuple") diff --git a/recipes/taocpp-tuple/all/test_package/CMakeLists.txt b/recipes/taocpp-tuple/all/test_package/CMakeLists.txt index 907f452b45903..d9a490f809bbc 100644 --- a/recipes/taocpp-tuple/all/test_package/CMakeLists.txt +++ b/recipes/taocpp-tuple/all/test_package/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) find_package(taocpp-tuple REQUIRED CONFIG) diff --git a/recipes/taocpp-tuple/all/test_package/conanfile.py b/recipes/taocpp-tuple/all/test_package/conanfile.py index 5562d97f4d2bb..38f4483872d47 100644 --- a/recipes/taocpp-tuple/all/test_package/conanfile.py +++ b/recipes/taocpp-tuple/all/test_package/conanfile.py @@ -1,10 +1,9 @@ -import os.path - 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): @@ -13,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)