Skip to content

zlib-ng: modernize more #14303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions recipes/zlib-ng/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from conan.tools.scm import Version
import os

required_conan_version = ">=1.50.0"
required_conan_version = ">=1.53.0"


class ZlibNgConan(ConanFile):
Expand Down Expand Up @@ -43,23 +43,17 @@ def config_options(self):

def configure(self):
if self.options.shared:
del self.options.fPIC
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")

def validate(self):
if self.info.options.zlib_compat and not self.info.options.with_gzfileop:
raise ConanInvalidConfiguration("The option 'with_gzfileop' must be True when 'zlib_compat' is True.")

def layout(self):
cmake_layout(self, src_folder="src")

def source(self):
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)
Expand Down
8 changes: 4 additions & 4 deletions recipes/zlib-ng/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.8)
project(test_package LANGUAGES C)

find_package(zlib-ng REQUIRED)
find_package(zlib-ng REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} zlib-ng::zlib-ng)
set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99)
target_link_libraries(${PROJECT_NAME} PRIVATE zlib-ng::zlib-ng)
target_compile_features(${PROJECT_NAME} PRIVATE c_std_99)
16 changes: 8 additions & 8 deletions recipes/zlib-ng/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import os

from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import cross_building
import os


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def layout(self):
cmake_layout(self)

def requirements(self):
self.requires(self.tested_reference_str)
Expand All @@ -17,10 +20,7 @@ def build(self):
cmake.configure()
cmake.build()

def layout(self):
cmake_layout(self)

def test(self):
if not cross_building(self):
if can_run(self):
cmd = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(cmd, env="conanrun")
9 changes: 0 additions & 9 deletions recipes/zlib-ng/all/test_package_v1/CMakeLists.txt

This file was deleted.

8 changes: 8 additions & 0 deletions recipes/zlib-ng/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
${CMAKE_CURRENT_BINARY_DIR}/test_package)
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# pylint: skip-file
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):
Expand Down