Skip to content

Commit

Permalink
restbed: expand minimum compiler conformance testing
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr committed Oct 21, 2022
1 parent 57082be commit 8e47eb1
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions recipes/restbed/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from conan import ConanFile
from conan.tools.scm import Version
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, rm, save
from conan.tools.build import check_min_cppstd
from conan.tools.microsoft import is_msvc
from conan.tools.scm import Version
import os
import re

Expand Down Expand Up @@ -32,6 +33,18 @@ class RestbedConan(ConanFile):
"with_openssl": True,
}

@property
def _minimum_cpp_standard(self):
return 14

@property
def _compilers_minimum_version(self):
return {
"gcc": "5",
"clang": "7",
"apple-clang": "10",
}

def export_sources(self):
export_conandata_patches(self)

Expand All @@ -50,10 +63,13 @@ def configure(self):

def validate(self):
if getattr(self.info.settings.compiler, "cppstd"):
check_min_cppstd(self, 14)
if self.info.settings.compiler == "gcc":
if self.info.settings.compiler.version < Version(5):
raise ConanInvalidConfiguration("gcc 5+ is required for c++14 support")
check_min_cppstd(self, self._minimum_cpp_standard)
if not is_msvc(self):
minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False)
if minimum_version and Version(self.info.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support."
)

def layout(self):
cmake_layout(self, src_folder="src")
Expand Down

0 comments on commit 8e47eb1

Please sign in to comment.