From b5d36e7fb763e2a2c178615b037fe82e0fc27439 Mon Sep 17 00:00:00 2001 From: SpaceIm <30052553+SpaceIm@users.noreply.github.com> Date: Tue, 18 Apr 2023 23:56:35 +0200 Subject: [PATCH] modernize more for conan v2 --- recipes/aws-c-compression/all/conanfile.py | 24 ++++++------------- .../all/test_v1_package/CMakeLists.txt | 8 +++---- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/recipes/aws-c-compression/all/conanfile.py b/recipes/aws-c-compression/all/conanfile.py index 032a16573f4d2..12d5eee265f5f 100644 --- a/recipes/aws-c-compression/all/conanfile.py +++ b/recipes/aws-c-compression/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class AwsCCompression(ConanFile): @@ -13,7 +13,7 @@ class AwsCCompression(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-compression" license = "Apache-2.0", - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,18 +30,9 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC - except Exception: - pass - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") @@ -50,8 +41,7 @@ def requirements(self): self.requires("aws-c-common/0.8.2") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -87,4 +77,4 @@ def package_info(self): self.cpp_info.components["aws-c-compression-lib"].names["cmake_find_package"] = "aws-c-compression" self.cpp_info.components["aws-c-compression-lib"].names["cmake_find_package_multi"] = "aws-c-compression" self.cpp_info.components["aws-c-compression-lib"].set_property("cmake_target_name", "AWS::aws-c-compression") - self.cpp_info.components["aws-c-compression-lib"].requires = ["aws-c-common::aws-c-common-lib"] + self.cpp_info.components["aws-c-compression-lib"].requires = ["aws-c-common::aws-c-common"] diff --git a/recipes/aws-c-compression/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-compression/all/test_v1_package/CMakeLists.txt index e3ad5964d2a88..0d20897301b68 100644 --- a/recipes/aws-c-compression/all/test_v1_package/CMakeLists.txt +++ b/recipes/aws-c-compression/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(aws-c-compression REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-compression) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package)