Repository: conan-io/conan-center-index

Issue:
[package] gtest/1.10.0: gcc version 4.8.5 should be ok
<!-- 
  Please don't forget to update the issue title.
  Include all applicable information to help us reproduce your problem.
-->

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **gtest/1.10.0**
  * Operating System+version: **Linux Centos 7**
  * Compiler+version: **GCC 4**
  * Docker image: **conanio/gcc8**
  * Conan version: **conan 1.18.0**
  * Python version: **Python 3.7.4**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
Configuration for profile default:

[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=4.8
compiler.libcxx=libstdc++
build_type=Release
[options]
[build_requires]
[env]
```


### Steps to reproduce (Include if Applicable)
Try to install the gtest/1.10.0 source, it fails even though GCC 4.8.5 should be ok since it supports c++11.


### Logs (Include/Attach if Applicable)
<details><summary>ERROR: gtest/cci.20210126: Invalid configuration: gtest requires c++11 support. The current compiler gcc 4.8 does not support it.
</summary>

```
Put your log output here
```

</details>



Discussion:

Resolving patch:
diff --git a/recipes/gtest/all/conanfile.py b/recipes/gtest/all/conanfile.py
--- a/recipes/gtest/all/conanfile.py
+++ b/recipes/gtest/all/conanfile.py
@@ -31,12 +31,19 @@ def _minimum_compilers_version(self):
             return {
                 "Visual Studio": "14"
             }
+        elif self.version == "1.10.0":
+            return {
+                "Visual Studio": "14",
+                "gcc": "4.8.1",
+                "clang": "3.3",
+                "apple-clang": "5.0"
+            }
         else:
             return {
                 "Visual Studio": "14",
                 "gcc": "5",
                 "clang": "5",
-                "apple-clang": "9.1",
+                "apple-clang": "9.1"
             }
         
     @property
@@ -54,13 +61,20 @@ def configure(self):
             tools.check_min_cppstd(self, self._minimum_cpp_standard)
         min_version = self._minimum_compilers_version.get(
             str(self.settings.compiler))
+
+        def lazy_lt_semver(v1, v2):
+            lv1 = [int(v) for v in v1.split(".")]
+            lv2 = [int(v) for v in v2.split(".")]
+            min_length = min(len(lv1), len(lv2))
+            return lv1[:min_length] < lv2[:min_length]
+
         if not min_version:
-            self.output.warn("{} recipe lacks information about the {} compiler support.".format(
+            self.output.warn("{} recipe lacks information about {} compiler support.".format(
                 self.name, self.settings.compiler))
         else:
-            if tools.Version(self.settings.compiler.version) < min_version:
-                raise ConanInvalidConfiguration("{} requires c++11 support. The current compiler {} {} does not support it.".format(
-                    self.name, self.settings.compiler, self.settings.compiler.version))
+            if lazy_lt_semver(str(self.settings.compiler.version), min_version):
+                raise ConanInvalidConfiguration("{0} requires {1} {2}. The current compiler is {1} {3}.".format(
+                    self.name, self.settings.compiler, min_version, self.settings.compiler.version))
 
     def source(self):
         tools.get(**self.conan_data["sources"][self.version])


Test patch: