diff --git a/recipes/exiv2/all/conandata.yml b/recipes/exiv2/all/conandata.yml index 0b36cf903900d..49ba0667271df 100644 --- a/recipes/exiv2/all/conandata.yml +++ b/recipes/exiv2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.28.3": + url: "https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.3.tar.gz" + sha256: "1315e17d454bf4da3cc0edb857b1d2c143670f3485b537d0f946d9ed31d87b70" "0.28.2": url: "https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.2.tar.gz" sha256: "543bead934135f20f438e0b6d8858c55c5fcb7ff80f5d1d55489965f1aad58b9" diff --git a/recipes/exiv2/all/conanfile.py b/recipes/exiv2/all/conanfile.py index 749096cccd372..93bf130b53027 100644 --- a/recipes/exiv2/all/conanfile.py +++ b/recipes/exiv2/all/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, check_max_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps from conan.tools.files import get, copy, rmdir, save, export_conandata_patches, apply_conandata_patches, replace_in_file from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, check_min_vs @@ -17,9 +17,9 @@ class Exiv2Conan(ConanFile): description = "Exiv2 is a C++ library and a command-line utility " \ "to read, write, delete and modify Exif, IPTC, XMP and ICC image metadata." license = "GPL-2.0" - topics = ("image", "exif", "xmp") - homepage = "https://www.exiv2.org" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.exiv2.org" + topics = ("image", "exif", "xmp") package_type = "library" settings = "os", "arch", "compiler", "build_type" @@ -88,8 +88,7 @@ def validate(self): if Version(self.version) >= "0.28.0": min_cppstd = 17 - if self.settings.compiler.cppstd: - check_min_cppstd(self, min_cppstd) + check_min_cppstd(self, min_cppstd) check_min_vs(self, 191) compilers_minimum_version = { @@ -97,16 +96,12 @@ def validate(self): "clang": "5", "apple-clang": "10", } - if not is_msvc(self): - minimum_version = compilers_minimum_version.get(str(self.settings.compiler), False) - if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration( - f"{self.ref} requires C++{min_cppstd}, which your compiler does not fully support." - ) - elif conan_version.major == 2: - # FIXME: linter complains, but function is there - # https://docs.conan.io/2.0/reference/tools/build.html?highlight=check_min_cppstd#conan-tools-build-check-max-cppstd - check_max_cppstd = getattr(sys.modules['conan.tools.build'], 'check_max_cppstd') + minimum_version = compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{min_cppstd}, which your compiler does not fully support." + ) + else: # https://github.com/Exiv2/exiv2/tree/v0.27.7#217-building-with-c11-and-other-compilers check_max_cppstd(self, 14) @@ -167,30 +162,6 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "share")) - # TODO: to remove in conan v2 once cmake_find_package_* generators removed - targets = {"exiv2lib": "exiv2::exiv2lib"} - if self.options.with_xmp == "bundled": - targets.update({"exiv2-xmp": "exiv2::exiv2-xmp"}) - self._create_cmake_module_alias_targets( - os.path.join(self.package_folder, self._module_file_rel_path), - targets - ) - - def _create_cmake_module_alias_targets(self, module_file, targets): - content = "" - for alias, aliased in targets.items(): - content += textwrap.dedent(f"""\ - if(TARGET {aliased} AND NOT TARGET {alias}) - add_library({alias} INTERFACE IMPORTED) - set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) - endif() - """) - save(self, module_file, content) - - @property - def _module_file_rel_path(self): - return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") - def package_info(self): self.cpp_info.set_property("cmake_file_name", "exiv2") self.cpp_info.set_property("pkg_config_name", "exiv2") @@ -223,10 +194,3 @@ def package_info(self): self.cpp_info.components["exiv2lib"].requires.append("exiv2-xmp") else: self.cpp_info.components["exiv2lib"].requires.append("expat::expat") - - # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["exiv2lib"].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components["exiv2lib"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - if self.options.with_xmp == "bundled" and Version(self.version) < "0.28.0": - self.cpp_info.components["exiv2-xmp"].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components["exiv2-xmp"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/exiv2/all/test_package/CMakeLists.txt b/recipes/exiv2/all/test_package/CMakeLists.txt index 69bbd22508c9b..47e4eda57e2b4 100644 --- a/recipes/exiv2/all/test_package/CMakeLists.txt +++ b/recipes/exiv2/all/test_package/CMakeLists.txt @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(exiv2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} exiv2lib) +target_link_libraries(${PROJECT_NAME} PRIVATE exiv2lib) if(${exiv2_VERSION} VERSION_GREATER_EQUAL "0.28.0") target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/exiv2/all/test_v1_package/CMakeLists.txt b/recipes/exiv2/all/test_v1_package/CMakeLists.txt deleted file mode 100644 index 0d20897301b68..0000000000000 --- a/recipes/exiv2/all/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -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) diff --git a/recipes/exiv2/all/test_v1_package/conanfile.py b/recipes/exiv2/all/test_v1_package/conanfile.py deleted file mode 100644 index b6a26067f365d..0000000000000 --- a/recipes/exiv2/all/test_v1_package/conanfile.py +++ /dev/null @@ -1,17 +0,0 @@ -import os - -from conans import ConanFile, CMake, tools - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) diff --git a/recipes/exiv2/config.yml b/recipes/exiv2/config.yml index f9244e625c48f..572fad2a57e09 100644 --- a/recipes/exiv2/config.yml +++ b/recipes/exiv2/config.yml @@ -1,4 +1,6 @@ versions: + "0.28.3": + folder: all "0.28.2": folder: all "0.28.1":