diff --git a/recipes/variant-lite/all/conandata.yml b/recipes/variant-lite/all/conandata.yml index ba0120108f73a..a253afe2aabae 100644 --- a/recipes/variant-lite/all/conandata.yml +++ b/recipes/variant-lite/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "1.2.2": - url: https://github.com/martinmoene/variant-lite/archive/v1.2.2.tar.gz - sha256: 97334108c3a92f7becc74e2798ab8e0ea57fd67d4ad893ec0b0b8e1c35bb411c "2.0.0": - url: https://github.com/martinmoene/variant-lite/archive/v2.0.0.tar.gz - sha256: 70c1509e24d03abfd22d2e702ab398238e69658b7b2890ce1d7e9731d6b5a7cb + url: "https://github.com/martinmoene/variant-lite/archive/v2.0.0.tar.gz" + sha256: "70c1509e24d03abfd22d2e702ab398238e69658b7b2890ce1d7e9731d6b5a7cb" + "1.2.2": + url: "https://github.com/martinmoene/variant-lite/archive/v1.2.2.tar.gz" + sha256: "97334108c3a92f7becc74e2798ab8e0ea57fd67d4ad893ec0b0b8e1c35bb411c" diff --git a/recipes/variant-lite/all/conanfile.py b/recipes/variant-lite/all/conanfile.py index 90106bb478bcc..14dd9dcb977eb 100644 --- a/recipes/variant-lite/all/conanfile.py +++ b/recipes/variant-lite/all/conanfile.py @@ -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 VariantLiteConan(ConanFile): name = "variant-lite" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/martinmoene/variant-lite" description = "variant lite - A C++17-like variant, a type-safe union for C++98, C++11 and later in a single-file header-only library" - topics = ("conan", "cpp98", "cpp11", "cpp14", "cpp17", "variant", "variant-implementations") + topics = ("cpp98", "cpp11", "cpp14", "cpp17", "variant", "variant-implementations") license = "BSL-1.0" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property @@ -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", "variant-lite") + self.cpp_info.set_property("cmake_target_name", "nonstd::variant-lite") + + # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "variant-lite" self.cpp_info.filenames["cmake_find_package_multi"] = "variant-lite" self.cpp_info.names["cmake_find_package"] = "nonstd" self.cpp_info.names["cmake_find_package_multi"] = "nonstd" self.cpp_info.components["variantlite"].names["cmake_find_package"] = "variant-lite" self.cpp_info.components["variantlite"].names["cmake_find_package_multi"] = "variant-lite" + self.cpp_info.components["variantlite"].set_property("cmake_target_name", "nonstd::variant-lite") diff --git a/recipes/variant-lite/all/test_package/CMakeLists.txt b/recipes/variant-lite/all/test_package/CMakeLists.txt index 91ff11209de6a..ee7a8aa722c74 100644 --- a/recipes/variant-lite/all/test_package/CMakeLists.txt +++ b/recipes/variant-lite/all/test_package/CMakeLists.txt @@ -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(variant-lite REQUIRED CONFIG) diff --git a/recipes/variant-lite/all/test_package/conanfile.py b/recipes/variant-lite/all/test_package/conanfile.py index abcaeed3f89b6..38f4483872d47 100644 --- a/recipes/variant-lite/all/test_package/conanfile.py +++ b/recipes/variant-lite/all/test_package/conanfile.py @@ -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): @@ -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) diff --git a/recipes/variant-lite/config.yml b/recipes/variant-lite/config.yml index 565c7b3d31a66..9e6e28e463759 100644 --- a/recipes/variant-lite/config.yml +++ b/recipes/variant-lite/config.yml @@ -1,5 +1,5 @@ versions: - "1.2.2": - folder: all "2.0.0": folder: all + "1.2.2": + folder: all