Skip to content

Commit

Permalink
modernize more for conan v2
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceIm committed Apr 18, 2023
1 parent fc4319a commit b5d36e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
24 changes: 7 additions & 17 deletions recipes/aws-c-compression/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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],
Expand All @@ -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")
Expand All @@ -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)
Expand Down Expand Up @@ -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"]
8 changes: 3 additions & 5 deletions recipes/aws-c-compression/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit b5d36e7

Please sign in to comment.