diff --git a/recipes/log4cplus/all/conandata.yml b/recipes/log4cplus/all/conandata.yml index a0ac90c32b364..3625645bc7de9 100644 --- a/recipes/log4cplus/all/conandata.yml +++ b/recipes/log4cplus/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.1.1": + url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_1_1/log4cplus-2.1.1.tar.bz2" + sha256: "6597de782775e4e0fba8fdcad938c3709fd839a8084c4b6edfae3cc5046e2688" "2.1.0": url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_1_0/log4cplus-2.1.0.tar.bz2" sha256: "a04945aca5fbc0487503c852befb9cdefbc3ae3fe614b08a905333f6df754387" @@ -8,38 +11,28 @@ sources: "2.0.7": url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_7/log4cplus-2.0.7.tar.bz2" sha256: "8fadbafee2ba4e558a0f78842613c9fb239c775d83f23340d091084c0e1b12ab" - "2.0.6": - url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_6/log4cplus-2.0.6.tar.bz2" - sha256: "1a963afd0f883d62de946b18927d238051fd47936e415eabeffe2b1397f16eca" - "2.0.5": - url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_5/log4cplus-2.0.5.tar.bz2" - sha256: "b38dbfc68ef6d771e4de7de0be3544bc51bd3f7d5b75c5f6500d10e23203eb15" - "2.0.4": - url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_4/log4cplus-2.0.4.tar.bz2" - sha256: "0c8a7b4cabff07032385f0c6d1a078d2a79c69b1c43b06991ca774fb85880252" - + # v1 is required for the openvdb recipe + "1.2.2": + url: "https://github.com/log4cplus/log4cplus/releases/download/REL_1_2_2/log4cplus-1.2.2.tar.bz2" + sha256: "853efd919f9ca76c518c0944e6b0ced1174523a86b6db046ed4f23fe695167bd" patches: - "2.1.0": + "2.1.1": - patch_file: "patches/2.0.6-0001-fix-cmake.patch" patch_description: "disable fPIC, move cmake_minimum_version to front" patch_type: "conan" - "2.0.8": + "2.1.0": - patch_file: "patches/2.0.6-0001-fix-cmake.patch" patch_description: "disable fPIC, move cmake_minimum_version to front" patch_type: "conan" - "2.0.7": + "2.0.8": - patch_file: "patches/2.0.6-0001-fix-cmake.patch" patch_description: "disable fPIC, move cmake_minimum_version to front" patch_type: "conan" - "2.0.6": + "2.0.7": - patch_file: "patches/2.0.6-0001-fix-cmake.patch" patch_description: "disable fPIC, move cmake_minimum_version to front" patch_type: "conan" - "2.0.5": - - patch_file: "patches/2.0.4-0001-fix-cmake.patch" - patch_description: "disable fPIC, move cmake_minimum_version to front" - patch_type: "conan" - "2.0.4": - - patch_file: "patches/2.0.4-0001-fix-cmake.patch" - patch_description: "disable fPIC, move cmake_minimum_version to front" + "1.2.2": + - patch_file: "patches/1.2.2-0001-fix-cmake.patch" + patch_description: "move cmake_minimum_version to front" patch_type: "conan" diff --git a/recipes/log4cplus/all/conanfile.py b/recipes/log4cplus/all/conanfile.py index 6d7e6eed30a07..5851367f991c2 100644 --- a/recipes/log4cplus/all/conanfile.py +++ b/recipes/log4cplus/all/conanfile.py @@ -1,6 +1,7 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, collect_libs -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, valid_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.scm import Version import os @@ -62,6 +63,8 @@ def requirements(self): def validate(self): if self.settings.compiler.cppstd: check_min_cppstd(self, 11) + if Version(self.version) < 2 and valid_min_cppstd(self, 17): + raise ConanInvalidConfiguration("log4cplus < 2.0.0 does not support C++17") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) diff --git a/recipes/log4cplus/all/patches/1.2.2-0001-fix-cmake.patch b/recipes/log4cplus/all/patches/1.2.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..29c239101f640 --- /dev/null +++ b/recipes/log4cplus/all/patches/1.2.2-0001-fix-cmake.patch @@ -0,0 +1,12 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -11,8 +11,8 @@ + # Remove when CMake >= 2.8.4 is required + set (CMAKE_LEGACY_CYGWIN_WIN32 0) + ++cmake_minimum_required (VERSION 3.15) + project (log4cplus) +-cmake_minimum_required (VERSION 2.8.12) + + enable_language (CXX) + include(GNUInstallDirs) diff --git a/recipes/log4cplus/all/patches/2.0.4-0001-fix-cmake.patch b/recipes/log4cplus/all/patches/2.0.4-0001-fix-cmake.patch deleted file mode 100644 index d76b76d7eee51..0000000000000 --- a/recipes/log4cplus/all/patches/2.0.4-0001-fix-cmake.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index abe12e0..73d443f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,3 +1,5 @@ -+cmake_minimum_required (VERSION 3.1) -+ - # This block needs to stay before the project (log4cplus) line so that - # the output files placed into Android's libs directory. - if (CMAKE_TOOLCHAIN_FILE) -@@ -12,10 +14,6 @@ endif () - set (CMAKE_LEGACY_CYGWIN_WIN32 0) - - project (log4cplus) --cmake_minimum_required (VERSION 3.1) -- --# Use "-fPIC" / "-fPIE" for all targets by default, including static libs. --set (CMAKE_POSITION_INDEPENDENT_CODE ON) - - enable_language (CXX) - if (MSVC) diff --git a/recipes/log4cplus/all/test_package/CMakeLists.txt b/recipes/log4cplus/all/test_package/CMakeLists.txt index d9b0e93737a79..0a50a283c1bb4 100644 --- a/recipes/log4cplus/all/test_package/CMakeLists.txt +++ b/recipes/log4cplus/all/test_package/CMakeLists.txt @@ -3,6 +3,10 @@ project(test_package LANGUAGES CXX) find_package(log4cplus REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) +if(log4cplus_VERSION VERSION_GREATER_EQUAL 2) + add_executable(${PROJECT_NAME} test_package.cpp) +else() + add_executable(${PROJECT_NAME} test_package_v1.cpp) +endif() target_link_libraries(${PROJECT_NAME} PRIVATE log4cplus::log4cplus) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/log4cplus/all/test_package/test_package_v1.cpp b/recipes/log4cplus/all/test_package/test_package_v1.cpp new file mode 100644 index 0000000000000..bd0d86df7ec39 --- /dev/null +++ b/recipes/log4cplus/all/test_package/test_package_v1.cpp @@ -0,0 +1,16 @@ +#include +#include +#include + +int main() +{ + log4cplus::initialize(); + + log4cplus::BasicConfigurator config; + config.configure(); + + log4cplus::Logger logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("main")); + LOG4CPLUS_WARN(logger, LOG4CPLUS_TEXT("Hello, World!")); + + return 0; +} diff --git a/recipes/log4cplus/config.yml b/recipes/log4cplus/config.yml index c48cbc75b8c2f..2862fb5934cdf 100644 --- a/recipes/log4cplus/config.yml +++ b/recipes/log4cplus/config.yml @@ -1,13 +1,11 @@ versions: + "2.1.1": + folder: all "2.1.0": folder: all "2.0.8": folder: all "2.0.7": folder: all - "2.0.6": - folder: all - "2.0.5": - folder: all - "2.0.4": + "1.2.2": folder: all