Repository: conan-io/conan-center-index

Issue:
[package] redis-plus-plius/<LIBRARY-VERSION>: SHORT DESCRIPTION
### Description

The current recipe has
```
     @property
     def _min_cppstd(self):
        return "11" if Version(self.version) < "1.3.0" else "17"
```

But the [README](https://github.com/sewenew/redis-plus-plus/blob/master/README.md#installation) says:

    However, it can also be built with the -std=c++11 or -std=c++14 standard, and in that case, we have our own simple
    implementation of std::string_view and std::optional. In order to explicitly specify c++ standard, you can use the
    following cmake flag: -DREDIS_PLUS_PLUS_CXX_STANDARD=11.

It looks like 17 is the default but they support C++11 and above.


### Package and Environment Details

* Package Name/Version: **redis-plus-plus**

Current recipe - all versions.

### Conan profile

[settings]
os=Macos
os_build=Macos
arch=armv8
arch_build=armv8
compiler=apple-clang
compiler.version=14
compiler.libcxx=libc++
build_type=Release
[options]
[conf]
[build_requires]
[env]


### Steps to reproduce

conan create . 1.3.12@ -s compiler.cppstd=14

### Logs

```
❯ conan create . 1.3.12@ -s compiler.cppstd=14
Conan 1 is on a deprecation path, please consider migrating to Conan 2
[HOOK - conan-center.py] pre_export(): [DEPRECATED GLOBAL CPPSTD (KB-H001)] OK
[HOOK - conan-center.py] pre_export(): [REFERENCE LOWERCASE (KB-H002)] OK
[HOOK - conan-center.py] pre_export(): [RECIPE METADATA (KB-H003)] OK
[HOOK - conan-center.py] pre_export(): [HEADER_ONLY, NO COPY SOURCE (KB-H005)] OK
[HOOK - conan-center.py] pre_export(): [FPIC OPTION (KB-H006)] OK
[HOOK - conan-center.py] pre_export(): [VERSION RANGES (KB-H008)] OK
[HOOK - conan-center.py] pre_export(): [RECIPE FOLDER SIZE (KB-H009)] Total recipe size: 21.2919921875 KB
[HOOK - conan-center.py] pre_export(): [RECIPE FOLDER SIZE (KB-H009)] OK
[HOOK - conan-center.py] pre_export(): [EXPORT LICENSE (KB-H023)] exports: None
[HOOK - conan-center.py] pre_export(): [EXPORT LICENSE (KB-H023)] exports: None
[HOOK - conan-center.py] pre_export(): [EXPORT LICENSE (KB-H023)] OK
[HOOK - conan-center.py] pre_export(): [TEST PACKAGE FOLDER (KB-H024)] OK
[HOOK - conan-center.py] pre_export(): [META LINES (KB-H025)] OK
[HOOK - conan-center.py] pre_export(): [CONAN CENTER INDEX URL (KB-H027)] OK
[HOOK - conan-center.py] pre_export(): [CMAKE MINIMUM VERSION (KB-H028)] OK
[HOOK - conan-center.py] pre_export(): [TEST PACKAGE - RUN ENVIRONMENT (KB-H029)] OK
[HOOK - conan-center.py] pre_export(): [SYSTEM REQUIREMENTS (KB-H032)] OK
[HOOK - conan-center.py] pre_export(): [CONANDATA.YML FORMAT (KB-H030)] OK
[HOOK - conan-center.py] pre_export(): [TEST PACKAGE - NO IMPORTS() (KB-H034)] OK
[HOOK - conan-center.py] pre_export(): [NO AUTHOR (KB-H037)] OK
[HOOK - conan-center.py] pre_export(): [NOT ALLOWED ATTRIBUTES (KB-H039)] OK
[HOOK - conan-center.py] pre_export(): [NO TARGET NAME (KB-H040)] OK
[HOOK - conan-center.py] pre_export(): [NO FINAL ENDLINE (KB-H041)] OK
[HOOK - conan-center.py] pre_export(): [NO REQUIRES.ADD() (KB-H044)] OK
[HOOK - conan-center.py] pre_export(): [DELETE OPTIONS (KB-H045)] OK
[HOOK - conan-center.py] pre_export(): [CMAKE VERBOSE MAKEFILE (KB-H046)] OK
[HOOK - conan-center.py] pre_export(): [CMAKE VERSION REQUIRED (KB-H048)] OK
[HOOK - conan-center.py] pre_export(): [CMAKE WINDOWS EXPORT ALL SYMBOLS (KB-H049)] OK
[HOOK - conan-center.py] pre_export(): [DEFAULT OPTIONS AS DICTIONARY (KB-H051)] OK
[HOOK - conan-center.py] pre_export(): [CONFIG.YML HAS NEW VERSION (KB-H052)] OK
[HOOK - conan-center.py] pre_export(): [PRIVATE IMPORTS (KB-H053)] OK
[HOOK - conan-center.py] pre_export(): [SINGLE REQUIRES (KB-H055)] OK
[HOOK - conan-center.py] pre_export(): [TOOLS RENAME (KB-H057)] OK
[HOOK - conan-center.py] pre_export(): [ILLEGAL CHARACTERS (KB-H058)] OK
[HOOK - conan-center.py] pre_export(): [CLASS NAME (KB-H059)] OK
[HOOK - conan-center.py] pre_export(): [NO CRLF (KB-H060)] OK
[HOOK - conan-center.py] pre_export(): [NO BUILD SYSTEM FUNCTIONS (KB-H061)] OK
[HOOK - conan-center.py] pre_export(): [TOOLS CROSS BUILDING (KB-H062)] OK
[HOOK - conan-center.py] pre_export(): [INVALID TOPICS (KB-H064)] OK
[HOOK - conan-center.py] pre_export(): [NO REQUIRED_CONAN_VERSION (KB-H065)] OK
[HOOK - conan-center.py] pre_export(): [TEST_TYPE MANAGEMENT (KB-H068)] OK
[HOOK - conan-center.py] pre_export(): [TEST PACKAGE - NO DEFAULT OPTIONS (KB-H069)] OK
[HOOK - conan-center.py] pre_export(): [MANDATORY SETTINGS (KB-H070)] OK
[HOOK - conan-center.py] pre_export(): [PYLINT EXECUTION (KB-H072)] OK
[HOOK - conan-center.py] pre_export(): [REQUIREMENT OVERRIDE PARAMETER (KB-H075)] OK
Exporting package recipe
redis-plus-plus/1.3.12 exports: File 'conandata.yml' found. Exporting it...
redis-plus-plus/1.3.12 exports: Copied 1 '.yml' file: conandata.yml
redis-plus-plus/1.3.12: Calling export_sources()
[HOOK - conan-center.py] post_export(): [CONANDATA.YML REDUCE (KB-H031)] Saving conandata.yml: {'sources': {'1.3.12': {'url': 'https://github.com/sewenew/redis-plus-plus/archive/1.3.12.tar.gz', 'sha256': '26c1e45cdbafe1af4d2cf756957b2268baab6f802b53bcdd435864620e2c03c7'}}, 'patches': {'1.3.12': [{'patch_file': 'patches/1.3.8-0001-fix-dependencies-injection.patch', 'patch_description': 'Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake', 'patch_type': 'conan'}]}}
[HOOK - conan-center.py] post_export(): [CONANDATA.YML REDUCE (KB-H031)] New conandata.yml contents: patches:
  1.3.12:
  - patch_description: Robust discovery & injection of dependencies, and handle missing
      hiredis_ssl-config.cmake
    patch_file: patches/1.3.8-0001-fix-dependencies-injection.patch
    patch_type: conan
sources:
  1.3.12:
    sha256: 26c1e45cdbafe1af4d2cf756957b2268baab6f802b53bcdd435864620e2c03c7
    url: https://github.com/sewenew/redis-plus-plus/archive/1.3.12.tar.gz

[HOOK - conan-center.py] post_export(): [CONANDATA.YML REDUCE (KB-H031)] OK
[HOOK - conan-center.py] post_export(): [DEFAULT SHARED OPTION VALUE (KB-H050)] OK
[HOOK - conan-center.py] post_export(): [LICENSE PUBLIC DOMAIN (KB-H056)] OK
redis-plus-plus/1.3.12: A new conanfile.py version was exported
redis-plus-plus/1.3.12: Folder: /Users/eric/.conan/data/redis-plus-plus/1.3.12/_/_/export
redis-plus-plus/1.3.12: Exported revision: f0afa07019446e0b3af475022dc218d4
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=apple-clang
compiler.cppstd=14
compiler.libcxx=libc++
compiler.version=14
os=Macos
os_build=Macos
[options]
[build_requires]
[env]

hiredis/1.2.0: Not found in local cache, looking in remotes...
hiredis/1.2.0: Trying with 'conancenter'...
Downloading conanmanifest.txt completed [0.18k]
Downloading conanfile.py completed [4.99k]
Downloading conan_export.tgz completed [0.38k]
Decompressing conan_export.tgz completed [0.00k]
hiredis/1.2.0: Downloaded recipe revision 0
redis-plus-plus/1.3.12 (test package): Installing package
Requirements
    hiredis/1.2.0 from 'conancenter' - Downloaded
    redis-plus-plus/1.3.12 from local cache - Cache
Packages
    hiredis/1.2.0:6841fe8f0f22f6fa260da36a43a94ab525c7ed8d - Missing
    redis-plus-plus/1.3.12:INVALID - Invalid

Installing (downloading, building) binaries...
ERROR: There are invalid packages (packages that cannot exist for this configuration):
redis-plus-plus/1.3.12: Invalid ID: Current cppstd (14) is lower than the required C++ standard (17).
```


Discussion:

Resolving patch:
diff --git a/recipes/redis-plus-plus/all/conanfile.py b/recipes/redis-plus-plus/all/conanfile.py
--- a/recipes/redis-plus-plus/all/conanfile.py
+++ b/recipes/redis-plus-plus/all/conanfile.py
@@ -33,7 +33,7 @@ class RedisPlusPlusConan(ConanFile):
 
     @property
     def _min_cppstd(self):
-        return "11" if Version(self.version) < "1.3.0" else "17"
+        return "11"
 
     @property
     def _compilers_minimum_version(self):
@@ -86,11 +86,8 @@ def source(self):
 
     def generate(self):
         tc = CMakeToolchain(self)
-        if self.settings.compiler.get_safe("cppstd"):
-            cppstd = str(self.settings.compiler.cppstd)
-            if cppstd.startswith("gnu"):
-                cppstd = cppstd[3:]
-            tc.cache_variables["REDIS_PLUS_PLUS_CXX_STANDARD"] = cppstd
+        cppstd = str(self.settings.get_safe("compiler.cppstd", 11)).replace("gnu", "")
+        tc.cache_variables["REDIS_PLUS_PLUS_CXX_STANDARD"] = cppstd
         tc.variables["REDIS_PLUS_PLUS_USE_TLS"] = self.options.with_tls
         if self.options.get_safe("build_async"):
             tc.cache_variables["REDIS_PLUS_PLUS_BUILD_ASYNC"] = "libuv"


Test patch: