From 7c30932a978d34eea87a55e9923c5ba24c44d312 Mon Sep 17 00:00:00 2001 From: Simon Humpohl Date: Thu, 24 May 2018 15:53:47 +0200 Subject: [PATCH] Check c++ version based on msvc version --- src/faber/config/cxx_checks.py | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/src/faber/config/cxx_checks.py b/src/faber/config/cxx_checks.py index 8d392466e..94b212197 100644 --- a/src/faber/config/cxx_checks.py +++ b/src/faber/config/cxx_checks.py @@ -12,9 +12,21 @@ class has_cxx11(try_compile): - src = r"""#if __cplusplus < 201103L + src = r""" +#ifdef _MSC_VER + +#if _MSC_VER < 1900 #error no C++11 -#endif""" +#endif + +#else + +#if __cplusplus < 201103L +#error no C++11 +#endif + +#endif +""" def __init__(self, features=(), if_=(), ifnot=()): try_compile.__init__(self, 'has_cxx11', has_cxx11.src, types.cxx, features, @@ -23,9 +35,21 @@ def __init__(self, features=(), if_=(), ifnot=()): class has_cxx14(try_compile): - src = r"""#if __cplusplus < 201402L + src = r""" +#ifdef _MSC_VER + +#if _MSC_VER < 1910 #error no C++14 -#endif""" +#endif + +#else + +#if __cplusplus < 201402L +#error no C++14 +#endif + +#endif +""" def __init__(self, features=(), if_=(), ifnot=()): try_compile.__init__(self, 'has_cxx14', has_cxx14.src, types.cxx, features,