Skip to content
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

fmt: Safely delete options in configure plus clean up #13727

Merged
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
36 changes: 18 additions & 18 deletions recipes/fmt/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
sources:
"5.3.0":
sha256: defa24a9af4c622a7134076602070b45721a43c51598c8456ec6f2c4dbb51c89
url: https://github.com/fmtlib/fmt/archive/5.3.0.tar.gz
"6.2.1":
sha256: 5edf8b0f32135ad5fafb3064de26d063571e95e8ae46829c2f4f4b52696bbff0
url: https://github.com/fmtlib/fmt/archive/6.2.1.tar.gz
"7.1.3":
sha256: 5cae7072042b3043e12d53d50ef404bbb76949dad1de368d7f993a15c8c05ecc
url: https://github.com/fmtlib/fmt/archive/7.1.3.tar.gz
"8.0.1":
url: "https://github.com/fmtlib/fmt/archive/8.0.1.tar.gz"
sha256: "b06ca3130158c625848f3fb7418f235155a4d389b2abc3a6245fb01cb0eb1e01"
"8.1.1":
url: "https://github.com/fmtlib/fmt/archive/8.1.1.tar.gz"
sha256: "3d794d3cf67633b34b2771eb9f073bde87e846e0d395d254df7b211ef1ec7346"
"9.0.0":
url: "https://github.com/fmtlib/fmt/archive/9.0.0.tar.gz"
sha256: "9a1e0e9e843a356d65c7604e2c8bf9402b50fe294c355de0095ebd42fb9bd2c5"
"9.1.0":
url: "https://github.com/fmtlib/fmt/archive/9.1.0.tar.gz"
sha256: "5dea48d1fcddc3ec571ce2058e13910a0d4a6bab4cc09a809d8b1dd1c88ae6f2"
"9.0.0":
url: "https://github.com/fmtlib/fmt/archive/9.0.0.tar.gz"
sha256: "9a1e0e9e843a356d65c7604e2c8bf9402b50fe294c355de0095ebd42fb9bd2c5"
"8.1.1":
url: "https://github.com/fmtlib/fmt/archive/8.1.1.tar.gz"
sha256: "3d794d3cf67633b34b2771eb9f073bde87e846e0d395d254df7b211ef1ec7346"
"8.0.1":
url: "https://github.com/fmtlib/fmt/archive/8.0.1.tar.gz"
sha256: "b06ca3130158c625848f3fb7418f235155a4d389b2abc3a6245fb01cb0eb1e01"
"7.1.3":
sha256: 5cae7072042b3043e12d53d50ef404bbb76949dad1de368d7f993a15c8c05ecc
url: https://github.com/fmtlib/fmt/archive/7.1.3.tar.gz
"6.2.1":
sha256: 5edf8b0f32135ad5fafb3064de26d063571e95e8ae46829c2f4f4b52696bbff0
url: https://github.com/fmtlib/fmt/archive/6.2.1.tar.gz
"5.3.0":
sha256: defa24a9af4c622a7134076602070b45721a43c51598c8456ec6f2c4dbb51c89
url: https://github.com/fmtlib/fmt/archive/5.3.0.tar.gz
patches:
"5.3.0":
- patch_file: "patches/fix-install-5.3.0.patch"
27 changes: 18 additions & 9 deletions recipes/fmt/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os

from conan import ConanFile
from conan.tools.cmake import CMake, CMakeToolchain
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
from conan.tools.layout import basic_layout, cmake_layout
from conan.tools.scm import Version
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import get, apply_conandata_patches, copy, rmdir, export_conandata_patches
from conan.tools.layout import basic_layout

required_conan_version = ">=1.52.0"

Expand All @@ -13,7 +13,7 @@ class FmtConan(ConanFile):
name = "fmt"
homepage = "https://github.com/fmtlib/fmt"
description = "A safe and fast alternative to printf and IOStreams."
topics = ("fmt", "format", "iostream", "printf")
topics = ("format", "iostream", "printf")
url = "https://github.com/conan-io/conan-center-index"
license = "MIT"
settings = "os", "arch", "compiler", "build_type"
Expand All @@ -34,7 +34,7 @@ class FmtConan(ConanFile):

@property
def _has_with_os_api_option(self):
return Version(str(self.version)) >= "7.0.0"
return Version(self.version) >= "7.0.0"

def export_sources(self):
export_conandata_patches(self)
Expand Down Expand Up @@ -66,11 +66,20 @@ def config_options(self):

def configure(self):
if self.options.header_only:
del self.options.fPIC
try:
del self.options.fPIC
except Exception:
pass
del self.options.shared
del self.options.with_os_api
try:
del self.options.with_os_api
except Exception:
pass
elif self.options.shared:
del self.options.fPIC
try:
del self.options.fPIC
except Exception:
pass

def package_id(self):
if self.info.options.header_only:
Expand All @@ -79,7 +88,7 @@ def package_id(self):
del self.info.options.with_fmt_alias

def source(self):
get(self, **self.conan_data["sources"][str(self.version)],
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)

def build(self):
Expand Down
20 changes: 9 additions & 11 deletions recipes/fmt/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
cmake_minimum_required(VERSION 3.15)
project(test_package CXX)
cmake_minimum_required(VERSION 3.8)
project(test_package LANGUAGES CXX)

find_package(fmt REQUIRED CONFIG)

# TEST_PACKAGE #################################################################
add_executable(${CMAKE_PROJECT_NAME} test_package.cpp)
set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14)
add_executable(test_package test_package.cpp)
target_compile_features(test_package PRIVATE cxx_std_14)
if(FMT_HEADER_ONLY)
target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt-header-only)
target_link_libraries(test_package PRIVATE fmt::fmt-header-only)
else()
target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt)
target_link_libraries(test_package PRIVATE fmt::fmt)
endif()

# TEST_RANGES ##################################################################
add_executable(test_ranges test_ranges.cpp)
set_property(TARGET test_ranges PROPERTY CXX_STANDARD 14)
target_compile_features(test_ranges PRIVATE cxx_std_14)
if(FMT_HEADER_ONLY)
target_link_libraries(test_ranges fmt::fmt-header-only)
target_link_libraries(test_ranges PRIVATE fmt::fmt-header-only)
else()
target_link_libraries(test_ranges fmt::fmt)
target_link_libraries(test_ranges PRIVATE fmt::fmt)
endif()
2 changes: 0 additions & 2 deletions recipes/fmt/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout

required_conan_version = ">=1.50.0"

class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "VirtualRunEnv"
Expand Down
25 changes: 4 additions & 21 deletions recipes/fmt/all/test_v1_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package CXX)
cmake_minimum_required(VERSION 3.1)
project(test_package)

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

find_package(fmt REQUIRED CONFIG)

# TEST_PACKAGE #################################################################
add_executable(${CMAKE_PROJECT_NAME} ../test_package/test_package.cpp)
set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14)
if(FMT_HEADER_ONLY)
target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt-header-only)
else()
target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt)
endif()

# TEST_RANGES ##################################################################
add_executable(test_ranges ../test_package/test_ranges.cpp)
set_property(TARGET test_ranges PROPERTY CXX_STANDARD 14)
if(FMT_HEADER_ONLY)
target_link_libraries(test_ranges fmt::fmt-header-only)
else()
target_link_libraries(test_ranges fmt::fmt)
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
12 changes: 6 additions & 6 deletions recipes/fmt/config.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
versions:
"5.3.0":
"9.1.0":
folder: all
"6.2.1":
"9.0.0":
folder: all
"7.1.3":
"8.1.1":
folder: all
"8.0.1":
folder: all
"8.1.1":
"7.1.3":
folder: all
"9.0.0":
"6.2.1":
folder: all
"9.1.0":
"5.3.0":
folder: all