From 8e52792aad051978bb0e5d95384c524673047fd2 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 23 Jan 2024 23:08:14 +0100 Subject: [PATCH] build: `_std_format_minimum_compilers_version` added --- conanfile.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/conanfile.py b/conanfile.py index 5a5a0986..634baa63 100644 --- a/conanfile.py +++ b/conanfile.py @@ -87,6 +87,15 @@ class MPUnitsConan(ConanFile): # , "msvc": "192" } + @property + def _std_format_minimum_compilers_version(self): + return { + "gcc": "13", + "clang": "17" + # , "apple-clang": "15" + # , "msvc": "192" + } + @property def _build_all(self): return bool(self.conf.get("user.build:all", default=False)) @@ -128,6 +137,12 @@ class MPUnitsConan(ConanFile): raise ConanInvalidConfiguration( f"{self.ref} requires at least {compiler} {min_version} ({compiler.version} in use)" ) + if not self.options.use_fmtlib: + min_version = self._std_format_minimum_compilers_version.get(str(compiler)) + if min_version and loose_lt_semver(str(compiler.version), min_version): + raise ConanInvalidConfiguration( + f"`std::format` requires at least {compiler} {min_version} ({compiler.version} in use). Use `-o use_fmtlib=True` instead." + ) def layout(self): cmake_layout(self)