diff --git a/recipes/fmt/all/conandata.yml b/recipes/fmt/all/conandata.yml index 62a5ea0960895..226084f79cbb0 100644 --- a/recipes/fmt/all/conandata.yml +++ b/recipes/fmt/all/conandata.yml @@ -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" diff --git a/recipes/fmt/all/conanfile.py b/recipes/fmt/all/conanfile.py index af95895649da5..ede2e264b4b15 100644 --- a/recipes/fmt/all/conanfile.py +++ b/recipes/fmt/all/conanfile.py @@ -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" @@ -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" @@ -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) @@ -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: @@ -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): diff --git a/recipes/fmt/all/test_package/CMakeLists.txt b/recipes/fmt/all/test_package/CMakeLists.txt index 66300c1349564..a71cd67f135ec 100644 --- a/recipes/fmt/all/test_package/CMakeLists.txt +++ b/recipes/fmt/all/test_package/CMakeLists.txt @@ -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() diff --git a/recipes/fmt/all/test_package/conanfile.py b/recipes/fmt/all/test_package/conanfile.py index b896898544c19..5fe5679b8d954 100644 --- a/recipes/fmt/all/test_package/conanfile.py +++ b/recipes/fmt/all/test_package/conanfile.py @@ -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" diff --git a/recipes/fmt/all/test_v1_package/CMakeLists.txt b/recipes/fmt/all/test_v1_package/CMakeLists.txt index cd856e0aa456a..925ecbe19e448 100644 --- a/recipes/fmt/all/test_v1_package/CMakeLists.txt +++ b/recipes/fmt/all/test_v1_package/CMakeLists.txt @@ -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/) diff --git a/recipes/fmt/config.yml b/recipes/fmt/config.yml index 5da590b43a6cd..7251dde3fac9f 100644 --- a/recipes/fmt/config.yml +++ b/recipes/fmt/config.yml @@ -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